CollateDocumentsEx
Page manipulation, Document assembly
Description
Collates pages from several open documents into the selected document with a per-source page range list, including reversed ranges.
Syntax
Delphi
Function TPDFlib.CollateDocumentsEx(Const SourceDocumentIDs: Array Of Integer; Const RangeLists: WideString; GroupSize: Integer): Integer;Parameters
| SourceDocumentIDs | Handles of the open source documents. The selected document must not appear in the list. |
|---|---|
| RangeLists | One page range list per source, separated by ;. An empty string selects all pages of every source, and an empty segment selects all pages of that source. Descending ranges such as 3-1 reverse the source, and duplicate pages are kept in the given order. |
| GroupSize | Number of pages appended from each source per round. |
Return values
| 0 | Invalid arguments, a range refers to a missing page, the segment count does not match the source count, or the copy failed; the selected document is unchanged. |
|---|---|
| 1 | The pages were collated onto the end of the selected document. |
Remarks
The classic single-sided scanner workflow scans the fronts in order and the backs in reverse; passing ;3-1 style range lists restores reading order in one call. All arguments are validated before the selected document is modified, so failed calls leave it untouched.
Example
// Fronts 1,2,3 and backs scanned in reverse order
PDF.CollateDocumentsEx([Fronts, Backs], ';3-1', 1);