Product: PDFTron [View, Annotate, Measurements and Layers & Performance Packages] WebViewer SDK
Product Version: 8.11.0
Please give a brief summary of your issue:
We would like, when possible (and if possible), to retrieve the scale from the PDF in order to avoid the user having to do it manually which could potentially lead to measurement errors.
Is it possible to retrieve the scale automatically from the PDF content and if so, how?
The scale itself is stored in each of the measurement annotations. What you can do, is get existing scales and then pre-populate each tool as needed.
let measurementManager = instance.Core.documentViewer.getMeasurementManager();
There are also other utility methods in the UI to pre-load scales:
This guide may also be handy.
Apart from any annotation, is the scale information itself stored in the PDF file itself as metadata? Our clients work with design agencies to design packaging so they receive PDFs on which they wish to make measurements but we would like, if possible, that the scale is not entered manually but directly extracted from the metadata of the PDF.
I reviewed the PDF specification to double check, and it seems that scale information is not stored within it. Scale is stored on a per-annotation basis.