Objectif Lune joins Upland Software.Learn more >

Back to all How-tos

PDF Page Count using the Alambic API

This simple script is used to count the number of pages in a PDF using the Alambic API, which is a very fast and efficient way to do so.

The script assumes the PDF is the data file, and returns the value as the pagecount local variable in the process.

Javascript Version

var MyPDF=Watch.GetPDFEditObject();
MyPDF.Open(Watch.GetJobFileName(), true);
Watch.SetVariable("pagecount", MyPDF.Pages().Count() );
MyPDF.Close();

VBScript Version

Dim PageCount
Dim MyPDF

Set MyPDF=Watch.GetPDFEditObject()
Call MyPDF.Open (Watch.GetJobFileName, true)
Watch.SetVariable "pagecount", MyPDF.Pages.Count()
MyPDF.Close()

Leave a Reply

Your email address will not be published. Required fields are marked *