AnalyzePageRanges

Workflow data tools, ActiveX, DLL

Description

Analyses a page selection and splits it into batches, returning a JSON report

Syntax

ActiveX

Function PDFlib::AnalyzePageRanges(RangeList As String, FirstPage As Long, LastPage As Long, BatchSize As Long) As String

DLL

const wchar_t* DLAnalyzePageRanges(int InstanceID, const wchar_t* RangeList, int FirstPage, int LastPage, int BatchSize);
const char* DLAnalyzePageRangesA(int InstanceID, const char* RangeList, int FirstPage, int LastPage, int BatchSize);

Parameters

InstanceIDLibrary instance returned by DLCreateLibrary
RangeListPage selection; repeated pages are kept so the report can count them
FirstPageFirst valid page number, usually 1; also the value of the first keyword
LastPageLast valid page number, usually the document page count; also the value of the last keyword and the base of r reverse offsets
BatchSizeNumber of selected pages per batch; 0 omits batching

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

Report

{"pages":[8,6,4,3],"compact":"8,6,4-3","totalCount":4,"uniqueCount":4,
 "duplicateCount":0,"minPage":3,"maxPage":8,
 "runs":[{"offset":0,"count":1,"firstPage":8,"lastPage":8,"direction":0},...],
 "batchSize":2,"batches":[{"offset":0,"count":2,"pages":"8,6"},
                          {"offset":2,"count":2,"pages":"4,3"}]}

Remarks

runs lists maximal contiguous runs with zero-based selection offsets and a direction of 1, -1 or 0 for a single page; compact is the shortest equivalent range list

Batches keep selection order, reverse order and repeated pages; each batch carries its zero-based offset, count and page list

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