CopyPageRangesEx

Extraction, Page manipulation

Description

Use this function to copy one or more pages from one open document to the selected document. Options can preserve the requested page order and enable semantic resource reuse across source documents. Smart resource mode hashes recursively resolved resource graphs before allocation, so equivalent fonts, images, colour spaces, patterns, shadings, and graphics states can share existing target objects even when source object numbers or dictionary order differ. Hash matches receive a structural comparison, while cyclic and identity-sensitive page or optional-content objects remain separate.

Syntax

Delphi

Function TPDFlib.CopyPageRangesEx(DocumentID: Integer; Const RangeList: WideString; Options: Integer): Integer;

ActiveX

Function PDFlib::CopyPageRangesEx(DocumentID As Long, RangeList As String, Options As Long) As Long

DLL

int DLCopyPageRangesEx(int InstanceID, int DocumentID, const wchar_t * 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.
OptionsOptions 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. Combine both flags with bitwise OR; 0 sorts the range and ignores duplicates

Return values

0The specified DocumentID was not valid or was the same as the selected document, or the RangeList was invalid, or Options contained an unsupported bit
1The pages were successfully copied from the specified document to the selected document