Get a Free Trial

Determining the size of PDF pages when targeting HTML elements

20 February 2019

Originally before we made the recent upgrades to the targeting of HTML elements in PDF, the resultant PDF page size was the same as the targeted HTML element. This is because we couldn’t find a reliable way to extract just the target from the PDF other than cropping everything else bar the HTML element.

However after much work we managed to provide the targeted HTML element, with margins around it, while also being compatible with the our templating system. Allowing users to specify headers and footers for the first time when using this feature.

Unfortunately, it soon became clear that there was another inconsistency when using the target feature. That orientation and page size related parameters were being ignored. This is because essentially a new special page size is being used for the PDF, while the target feature works in the same way in our image capture API, as it is document based, it should probably be consistent with our DOCX API were the targeted HTML element appears at the top of the resultant document.

So we have changed how this feature works to create a PDF page with the size and orientation requested, with the targeted content appearing in the top left corner, consistent with the DOCX API.

View the latest blog posts