XML report: Convert pt to mm
Users can convert pt into mm "on the fly"in an XML report's page box dimensions.
Understanding the basics
A sample Profile when run against a sample PDF like below:
/pdfToolbox /Image_resolutions_10_ppi.kfpx /test_X-1a.pdf --report=XML
Click to copy
generates an XML report with page dimensions in pt:
..omitted..
<pages>
<page id="PAG1" nr="1"
mediabox="0.0/0.0/595.280029/841.890015"
effective_mediabox="0.0/0.0/595.280029/841.890015"
cropbox="0.0/0.0/595.280029/841.890015"
effective_cropbox="0.0/0.0/595.280029/841.890015"
trimbox="0.0/0.0/595.280029/841.890015"
effective_trimbox="0.0/0.0/595.280029/841.890015">
..omitted..
Click to copy
Transform the data with XSLT report
In the XML reports, most measurements are in pt. Most users of the report do some code for extraction and convert the values easily. The XSLT report is exactly that: It uses the internally geneated XML report and is converting the contained measurements.
Usage:
/pdfToolbox /Image_resolutions_10_ppi.kfpx /test_X-1a.pdf --report=XSLT=transform_pageboxes_into_mm.xslt
Click to copy
The XML data can be changed or extended with XSLT (attached below) as needed.
Report:
..omitted..
<pages>
<page id="PAG1" nr="1"
mediabox="0/0/210/297"
effective_mediabox="0/0/210/297"
cropbox="0/0/210/297"
effective_cropbox="0/0/210/297"
trimbox="0/0/210/297"
effective_trimbox="0/0/210/297">
..omitted..
Click to copy