I have as data input PDF’s in portrait and also landscape format. How can I set a page switch in designer to assign the right print layout? As print layout I’ve created 2 pages, 1 as A4 portrait and the other as A4 landscape.
Assuming that each multi-page PDF represents a single record, you can get each page Width and Height in the datamapper with the following commands:
add a field of type “Float” based on JavaScript and get the page width. Let’s name this field pageWidth:
steps.currentPageWidth;
Do the same for the page height. Let’s name the field for the current page height: pageHeight
steps.currentPageHeight;
Next, add a control script which will enable only the Portrait section if pageHeight < pageWidth and vice versa. In the below control script, ‘Landscape’ and ‘Portrait’ represent the names of the landscape and portrait sections respectively: