CopyPageRangesExA
Extraction, Page manipulation
Description
The trailing A denotes the ANSI (char) DLL entry point; the ActiveX/COM surface exposes only the Unicode form. Behaviour is identical to CopyPageRangesEx and string arguments are interpreted using the current SetAnsiMode code page
Use this function to copy one or more pages from one document to another. It is functionality identical to the CopyPageRanges function but adds an option to allow the page list to contain duplicate page numbers and a different page order to the original document
Syntax
Delphi
Function DLCopyPageRangesExA(InstanceID, DocumentID: Integer; RangeList: PAnsiChar; Options: Integer): Integer;
DLL
int DLCopyPageRangesExA(int InstanceID, int DocumentID, const char* RangeList, int Options);
Parameters
| DocumentID | The ID of the document to copy the pages from |
|---|---|
| RangeList | The pages to extract, for example "10,15,18-20,25-35". Invalid characters in the string will be ignored |
| Options | Options is a bit mask. PDF_COPY_PAGE_KEEP_ORDER (1) preserves the requested order and duplicates. PDF_COPY_PAGE_SMART_RESOURCES (2) reuses semantically equivalent resource dictionaries and streams already present in the target. At most one duplicate field name flag may be added: PDF_COPY_PAGE_FAIL_DUPLICATE_FIELDS (4) makes the call fail when a field on the copied pages has the same name as a field already in the target, PDF_COPY_PAGE_SYNC_DUPLICATE_FIELDS (8) gives such a copied field the value and default value of the existing one, and PDF_COPY_PAGE_RENAME_DUPLICATE_FIELDS (16) renames it with a numeric suffix such as Name_2. Combine flags with bitwise OR; 0 sorts the range, ignores duplicates and copies fields under their own names |
Return values
| 0 | The specified DocumentID was not valid or was the same as the selected document, or the RangeList was invalid, or Options contained an unsupported bit or more than one duplicate field name flag, or PDF_COPY_PAGE_FAIL_DUPLICATE_FIELDS was set and a field name conflict was found |
|---|---|
| 1 | The pages were successfully copied from the specified document to the selected document |
Remarks
Optional content groups (layers) the copied pages use are registered in the target document with their default state, so a layer that was off in the source stays off. A link, widget or bead that points at a page that was not copied is given a null target rather than a reference to an unrelated object. Named destinations that point at a copied page come along, retargeted at the copy; a name the target already uses gets a numeric suffix such as Chap_2, and links on the copied pages follow the new name. The copied pages keep their page labels, continuing the source numbering, while the pages already in the target keep theirs. When the source is tagged, the structure elements with content on the copied pages are copied under the target's structure tree, which is created if needed, and the parent tree is rebuilt for the copies; elements whose content was not copied are left out. When PDF_COPY_PAGE_SMART_RESOURCES (2) is set, identical streams and non-structural resource dictionaries inside the copied structure subtree are also deduplicated against the target document