AlambicEdit API reference
The AlambicEdit library allows Workflow to access, create or modify PDF files. It does so by wrapping Adobe PDF Library API calls in an object-oriented COM API. The use of COM as the underlying technology allows Workflow's scripting environment to create an instance of that COM object through the Watch.GetPDFEditObject method (see The Watch Object).
The object's hierarchy is modeled on the PDF document structure:
- The
PDF
object defines methods to open, close and save files, as well as to access meta information such as the XMP attachment. It contains a Pages collection object to access the list of pages in the PDF. (See PDF object.) - The
Pages
collection object defines methods to add, import, move or delete pages as well to access individual Page items. (See Pages collection object.) - The
Page
object defines methods to retrieve information from a page or modify it. (See Page object.)
PdfInfos, PdfPrintParams and PdfRect are the structures used.
Optimizing memory usage over performance when processing PDF files
By default, the PDF Libary is used within AlambicEdit as an in-process COM server. This entails that Workflow has very little control over the process, including memory management. Memory leaks can cause stability issues over a longer period of time. In order to prevent memory issues, the PDF Library can be used as an out-of-process COM server, in other words: to offload PDF processing to a helper program. This depends on a setting made per Workflow process; see Process properties. Note that this may impact performance, due to the additional overhead of starting the external program and inter-process communication.
Note: In OL Connect, PDF files are normally best handled by OL Connect tasks. However, the AlambicEdit API can provide a solution in special situations; see for example Stamping one PDF file on another PDF file.
Syntax conventions
The syntax for methods, properties and structures is as follows.
Methods
Syntax
methodName([arg1[, arg2[,...]]])
The type of each argument is specified in the description.
What a method returns is specified below the description of the arguments.
In case of failure, methods raise an exception.
Examples
Open(fileName, doRepair)
GetXYML()
JavaScript implementation:
myPDF.Open("C:\\PDFs\\SomeDocument.pdf", false);
var myXYML = myPDF.GetXYML();
Note: In JavaScript, all method calls must include parentheses, even for methods that do not require arguments (e.g. Watch.GetPDFEditObject(), myPDF.Pages() ).
VBScript implementation:
myPDF.Open "C:\\PDFs\\SomeDocument.pdf", false
myXYML = myPDF.GetXYML
Properties
Syntax
propName
Examples
Orientation. (Integer.)
JavaScript implementation:
var currentOrientation = myPDF.Pages(0).Orientation;
myPDF.Pages(0).Orientation = 180;
VBScript implementation:
currentOrientation = myPDF.Pages(0).Orientation
myPDF.Pages(0).Orientation = 180;
Structures
Syntax
STRUCT_NAME {
fieldName1[,
fieldName2[,
...]]
}
Examples
IPDFRect {
left,
top,
right,
bottom
}
left, top, right and bottom are integers.
JavaScript implementation:
var pdfRect = myPDF.Pages(0).Size();
var pageWidth = pdfRect.right - pdfRect.left;
VBScript implementation:
set pdfRect = myPDF.Pages(0).Size
pageWidth = pdfRect.right - pdfRect.left