CopyPageRanges
Extraction, Page manipulation
Description
Use this function to copy one or more pages from one document to another
The pages are copied in sequential order and duplicates are not allowed. To extract pages in a different order to the source document or with duplicate pages the CopyPageRangesEx function can be used
See Page selection syntax for strides, exclusions, open bounds and end-relative selectors
Syntax
Delphi
Function TPDFlib.CopyPageRanges(DocumentID: Integer; Const RangeList: WideString): Integer;
ActiveX
Function PDFlib::CopyPageRanges(DocumentID As Long, RangeList As String) As Long
DLL
int DLCopyPageRanges(int InstanceID, int DocumentID, const wchar_t* RangeList);
int DLCopyPageRangesA(int InstanceID, int DocumentID, const char* RangeList);
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 and duplicate page numbers in the string will be ignored. Reversed page ranges such as "5-1" will be accepted. The list of pages will be sorted resulting in the pages being extracted in numerical order |
Return values
| 0 | The specified DocumentID was not valid or was the same as the selected document, or the RangeList was invalid |
|---|---|
| 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