PDF object

The PDF object implements the IPDF interface. This interface defines methods to open, close and save files, as well as to access meta information such as the XMP attachment. The interface also implements a Pages collection object to access the list of pages in the PDF.

To instantiate the PDF object, call the Watch.GetPDFEditObject method in Workflow's scripting environment.

Javascript implementation: var myPDF = Watch.GetPDFEditObject();

VBScript implementation: set myPDF = Watch.GetPDFEditObject

IPDF methods

Name

Return type

Description

Close()

 

Closes the PDF file. If changes were made but not saved, they are silently lost. All IPage objects must be released before closing a PDF.

Create(filename)

 

Creates a new empty PDF file.

GetInfos()

IPdfInfos

Retrieves the contents of the Document Information Dictionary from the PDF.

GetVersion(*major, *minor)

 

Returns the version of the underlying PDF file format. For example, for PDF 1.7, 1 is returned in major and 7 is returned in minor.
Note that this method is not available in scripts.

GetXMP()

STRING

Retrieves the XMP attachment embedded in the PDF.

GetXYML()

STRING

Retrieves the entire extractable text from the PDF in XYML format.

IsProtected(filename)

BOOL

Returns True if the PDF file is password-protected. When a file is password-protected, the OpenEx() method must be used instead of the Open() method.

MergeWith(pdfFilename)

 

Merges the pages of pdfFilename (the source) with the pages of the current PDF (the destination).

MergeWith2(pdfFilename, xnum, ynum, xoffset, yoffset, scaleFactor)

 

Overlays each page of pdfFilename (the source) onto pages of the current PDF (the destination) in a grid whose size is specified by xnum and ynum. The pages are laid from left to right and then from top to bottom.

Open(filename, doRepair)

 

Opens an existing PDF, optionally repairing it.

OpenEx(filename, password, doRepair)

 

Opens an existing, password-protected PDF, optionally repairing it.

Pages()

IPages (see Pages collection object)

Provides access to the Pages collection of the PDF.

Print(printername)

 

Prints a range of PDF pages to the specified Windows printer with default options.

PrintEx(printername, *PdfPrintParams)

 

Prints a range of PDF pages to the specified Windows printer with specific printer options stored in an IPdfPrintParams structure.

Save()

 

Saves changes to the PDF file. The version of the PDF file format is the highest possible for a newly created file and is unchanged when saving an existing file, unless the SetVersion method was called in which case the file format used will be the one set by SetVersion.

SetInfos(Infos)

 

Sets the contents for the PDF's Document Information Dictionary.

setTolerances(tolerableDeltaWidth, tolerableDeltaHeight, tolerableDeltaFontHeight, tolerableGap)

 

Sets the floating point values for the tolerable factors.

SetVersion (major, minor)

 

Sets the version of the underlying PDF file format. This is applied when the file is saved.

SetXMP(xmpPacket)

 

Sets the XMP attachment by replacing the existing one with xmpPacket.