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 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. (See PDF object.)
  • The Pages collection object implements the IPages interface. This interface defines methods to add, import, move or delete pages as well to access individual Page items. (See Pages collection object.)
  • The Page object implements the IPage interface. This interface defines methods to retrieve information from a page or modify it. A page may also be drawn on a Windows Device Context (DC), but note that access to DCs may not be available in all scripting languages. (See Page object.)

IPdfInfos, IPdfPrintParams and IPdfRect are the structures used.

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

RETURN_VALUE_TYPE methodName( [ARGUMENT_TYPE arg1[, ARGUMENT_TYPE arg2[,...]]] )

Methods with a RETURN_VALUE_TYPE of VOID do not have a return value.

In case of failure, methods raise an exception.

Examples

VOID Open( STRING fileName, BOOLEAN doRepair )

STRING 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

PROPERTY_TYPE propName

Examples

INTEGER Orientation

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 {
FIELD_TYPE fieldName1[,
FIELD_TYPE fieldName2[,
...]]
}

Examples

IPDFRect {
LONG left,
LONG top,
LONG right,
LONG bottom
}

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