ExpandPageRanges
Workflow data tools, ActiveX, DLL
Description
Expands a page selection into an explicit comma-separated list of page numbers
Syntax
ActiveX
Function PDFlib::ExpandPageRanges(RangeList As String, FirstPage As Long, LastPage As Long, Options As Long) As StringDLL
const wchar_t* DLExpandPageRanges(int InstanceID, const wchar_t* RangeList, int FirstPage, int LastPage, int Options);
const char* DLExpandPageRangesA(int InstanceID, const char* RangeList, int FirstPage, int LastPage, int Options);
Parameters
| InstanceID | Library instance returned by DLCreateLibrary |
|---|---|
| RangeList | ASCII page selection such as 1-3,7, 8-1/2 (every second page in reverse), first-r2 or 1-10,!4-6; selections are limited to 65,536 characters |
| FirstPage | First valid page number, usually 1; also the value of the first keyword |
| LastPage | Last valid page number, usually the document page count; also the value of the last keyword and the base of r reverse offsets |
| Options | Sum of 1 to sort ascending, 2 to keep repeated pages, 4 to reject repeated pages, and 8 to ignore pages outside the document instead of failing; 0 keeps selection order and drops repeats |
Return values
Returns a borrowed string that stays valid until a later call on the same instance; copy it at once, using DLStringResultLength for the wide function or DLAnsiStringResultLength for the ANSI function. A successful empty result is a valid empty string. Nil means the input was rejected; call GetWorkflowToolsError for the reason. The list uses commas without spaces, for example 8,6,4,2,3, and may be empty
Remarks
The list preserves the order in which pages were selected unless sorting is requested
Expansion is limited to 1,000,000 pages and a bounded amount of work
The ANSI function converts text using the instance's SetAnsiMode setting; use UTF-8 mode for non-ASCII data
ActiveX exposes this method on IPDFlibrary24; obtain it with CoPDFlibrary.CreateEditionTools24 or query the default interface of PDFlibAX 4.74 or later
All editions include these functions. Failed ActiveX calls return an empty string, 0 or Empty and record the reason for GetWorkflowToolsError. The C#, VB.NET and Visual C++ WorkflowTools examples in the DLL and ActiveX demo folders show a complete request, page plan and rollback workflow
See also
Workflow data tools · Virtual file registry · GetWorkflowToolsError