webCOMAND

#PDF

Create and manipulate PDF file pages.  Operations are limited to getting the number of pages in an existing PDF and assembling new PDFs from pages within existing PDFs.

Prototype

#PDF($operation, ...)

Parameters

  • operation - One of the following operations, which may require subsequent parameters.  File parameters may be a filename or PDF file data.
    • New - Create and return a new PDF Object with no pages.
    • GetPageCount - Get the number of pages in the PDF file whose contents are passed as the next parameter.
      • PDF File - The filename or contents of a PDF file.
    • ImportPage - Import a page into the in-memory PDF file from a page within another PDF file based on the following parameters.
      • PDF Object - PDF Object returned by the New operation.
      • PDF File - Filename or contents of another PDF file where the page will be imported from.
      • Page Index - Optional, zero based index of the page to import from the PDF File.
    • Output - Return the contents of the resulting PDF file
      • PDF Object - PDF Object returned by the New operation and manipulated with other operations.
    • Close - Close the PDF Object and release the memory.
      • PDF Object - PDF Object returned by the New operation and manipulated with other operations.

Return

Returns a handle to the in-memory PDF, which should ultimately be Output (see Output operation).

Example

#NEW($pdf)#PDF(New)#ENDNEW
#PDF(ImportPage,$pdf,'a.pdf',0)
#PDF(ImportPage,$pdf,'b.pdf',1)
#NEW($data)#PDF(Output,$pdf)#ENDNEW
#PDF(Close,$pdf)
#OUTPUT('my.pdf',$data)

Related

#FILE can be used to determine if a file is a PDF.

#IMAGE can be used to produce thumbnails from a PDF and work with PDF pages as images.