CFLExtractPagesFromPDF Procedure

  • 2 minutes to read

Codeunit CFL PDFProgram

Extract pages from a PDF Files

Signature

CFLExtractPagesFromPDF(PDFBase64: text; PageRange: text) Base64: text

Parameters

PDFBase64 text

PageRange text

Returns

text

Base64 of PDF with extracted pages

Remarks

/// PageRange is a string that contains the pages that need to be extracted /// PageRange can be a single page, a range of pages or a combination of both /// PageRange can be a positive or negative number /// Negative numbers are counted from the last page /// -1 = the last page /// PageRange can be a comma or pipe separated list of pages /// 3|5|7 = 3,5,7 = pages 3, 5 and 7 /// PageRange can be a range from..to /// 1..5 = pages 1 tem 5 /// PageRange can be a combination of positive and negative numbers /// PageRange can be a combination of comma and pipe separated list of pages and ranges /// 1..3|-5..-1 = first 3 pages and last 5 pages /// Ranges can also be open ..to /// ..5|-5.. = first 5 pages and last 5 pages /// If pages are in multiple ranges, they are added multiple times /// 1|1|1..5 = page 1, page 1 again and then pages 1 tem 5 /// If a range is descending, the pages are added in reverse order /// 10..5 = page 10, page 9, page 8, etc. /// -1..1 = page -1, page -2, page -3, etc., so all pages in reverse order /// Invalid pages are ignored /// Out-of-range start or end range is de-facto first or last page /// Result is the original PDF if no pages are extracted ///