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

DocumentIDThe ID of the document to copy the pages from
RangeListThe pages to extract, for example "10,15,18-20,25-35". Invalid characters in the string will be ignored.
Options0 = Identical behaviour to the CopyPageRanges function. The page list is sorted and duplicate page numbers are ignored. 1 = Do not sort the page list and allow duplicate page numbers

Return values

0The specified DocumentID was not valid or was the same as the selected document, or the RangeList was invalid
1The 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, whilst 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