_document.reprocess
Do this same document data again.
Syntax
_document.reprocess()
Parameters
None
Returned Value
None
Description
It's really easy to put Merge into an infinite loop when using _document.reprocess
. We advise that only experts in DocOrigin use this.
_document.reprocess
is almost certainly used with _document.abandon.
This function sets an internal flag such that at the end of the current Merge processing stage, Merge will process this document's data set over again. This may be desirable, without abandon, as some obscure way to produce multiple copies. You could set an _cache
variable to "Customer Copy" or "Store Copy", for instance, and use that _cache
variable to populate a footer, but there are other better ways to achieve that goal. Where it is more likely applicable, and even then only rarely, is in taking action based on information that only the presentation software (Merge) knows. For the most part that is the page count (see the example below). The internal abandon and reprocess flags are set to false at the start of every Merge processing loop.
Examples
Consider that one and two-page documents are folded to fit into a simple business envelope, but three or more require a large envelope and either no or different folding. Well, the amount of paper needed depends on the size of the headers used. So the idea is to switch headers based on the number of pages being generated. But we don't know the number of pages until we paginate. Generally, that's too late to substitute in a different sized header. So we may want to abandon the current rendering and do a new one with a different header in use. At the Start of Job and End of Document events...
_cache.useHeader = "normal";
At the Pagination Completed event...
pageCount = _printer.getPageCount(); if (pageCount > 4 && _cache.useHeader._value == "normal") { _cache.useHeader = "manyPagesHeader"; _document.reprocess(); // Set flag to start this document over again _document.abandon(); // Set flag to abandon at the end of the current stage }
In the Data Merged event for each header...
this._visible = (_cache.useHeader == "the one that applies");
Certainly, you should pick the most common scenario as the default rather than incurring reprocessing overhead. One could "go wild" by reprocessing to handle repagination if you foolishly change the document contents significantly at the Pagination Complete stage. Not recommended. And watch for loops.