How do I change the ruler sample to show PDF pt's instead of cm's?

17 views
Skip to first unread message

Ryan - PDFNet Developer

unread,
Jan 10, 2019, 6:07:16 PM1/10/19
to PDFTron WebViewer
Question:

The custom-annotations ruler annotation displays the measurement in cm's. For example "23.02cm".

How can I get it to display pt's instead?

Answer:

In the file samples/annotation/custom-annotations/ruler.js you would remove the following two lines

var inches = (distance / 72).toFixed(2); // assume 72 dpi
var distanceText = (inches / 0.39370).toFixed(2) + 'cm';

And replace with

var distanceText = distance.toFixed(2) + 'pts';



Reply all
Reply to author
Forward
0 new messages