Upland OL User community

Get incoming pdf pagesizes

using a simple workflow to stamp some datamatrix on incoming pdf documents, I use datamapper searching for specific coding and a blank template with an output preset doing the datamatrix stamping.

Since input documents may vary in size I want to switch print context sections. (if it’s > DIN A4 use bigger section for documents with bleed).

How can I get the pagesize in datamapper or should I use a workflow script with alambicedit ( myPDF.Pages(0).Size()) to get the size and two different All-in-one setups?

thx for any idea.


In the same document, are all the pages the same size?

yes, I know how to do in in workflow,
but if I had the pagesize from datamapper I’d enable/disable different sections.

In the datamapper create a datafield and use an action step to store the temp filename of the datamapper pdf.

record.fields.myNewDataField = data.filename;

In the Designer create a control script and get height and width of the datamapper pdf.

var bg = record.fields.myNewDataField;
var pdf_height = resource(bg).height;
var pdf_width = resource(bg).width;

Complete the control script with the desired if-statements and the control of which print section should be output.

Hop that helps,

Thomas! Great! Thx a lot.

Hi Thomas, What units does this return the measurement in?

As specified in this online help page, the units of measurements are in points.

Thanks @Phil , Created the below control script, but when I’m putting in a A4 job which was output from a previous PReS template and neither condition is been set to true. Is there a way to see what is been returned for the width and height?

Use something like logger.info('PDF width : ’ +pdf_width), the value will be displayed in your Messages panel.

ah perfect thanks. Is there a way to convert to 0 decimal places?


@Phil doesn’t matter just found Math.round.

Big thanks for your help on this


So got a strange issue no when I run the template through workflow. My pages are setup as per the below:

So the page control turns the pages on or off depending on the page size. When I run from teh template it works fine, however when I run through workflow teh first page of the input PDF is printed 4 times, once on each page, but then the rest are the same. So it’s like it’s not running the page control until it gets the 2nd record. Any idea’s?

Below is the page control script:


How do you get the page sizes within workflow? I need to check each page size and reject from within a workflow script.



Use the AlambicEdit API. What you’re looking for specifically is the PDF.Pages(i).Size() method which returns a PDFRect structure.

See https://help.objectiflune.com/files/EN/alambicedit-api/AlambicEdit.html

thanks Phil thats perfect