ExtractPagesFromDocument
ExtractPagesFromDocument() function extracts chosen pages from the given document. You have to provide an index of the starting page from which the extraction process will begin. You may also give a number of pages to extract. The ExtractPagesFromDocument() function creates a brand new file without changing the original one.
Syntax
ExtractPagesFromDocument(documentName|documentFieldName, pageFrom); ExtractPagesFromDocument(documentName|documentFieldName, pageFrom, pages);
Arguments
- documentName – (String) a name of the document from the case document list;
- documentFieldName – (String) a name of the document-type field;
- pageFrom – (Decimal) an index of the starting page from which the extraction begins;
- pages – (Decimal) a number of pages to extract.
Return Value
Returns a content of the newly created document with the chosen pages.
Type: File
Examples
Example 1
This will extract the first page from the document placed in „Invoice” field and assign that file to the „First page” field. The resulting file will have a name taken from the name of the source file and added suffix: _pages_1_1.
[First page]=ExtractPagesFromDocument("Invoice", 1, 1);
Example 2
This will extract the first page from the document placed in „Invoice” field. Next it will set its name to „firstpage.pdf” and assign this resulting file to „First page” field.
file=ExtractPagesFromDocument("Invoice",1,1); file.fileName="firstpage.pdf"; [First page]=file;
Example 3
This will extract pages starting with the second page till the end of the document placed in „Invoice” field. Next it will assign the resulting file to „Rest of the document” field on the case form.
[Rest of the document]=ExtractPagesFromDocument("Invoice",2);