Using the New Measurement Functionality when Exporting to Adobe® .pdf Files

Sergey Sherstnev

October 17, 2017

Teigha’s PDF Export functionality now supports accurate measurements of CAD data in exported .pdf files. Let’s look at how it can be used and how it looks in a .pdf file.

image1

In this example, the drawing has a line and a rectangle around it just to define the extents. The line parameters are:

image2

So, the length of the line is exactly 100mm.

Let’s try to export the drawing to a .pdf file. We use the option for Plot area – Display and plot scale 1:1. Next, use a “Measuring tool” in a PDF reader to check the length.

image3

So, the length is 99,99mm, which is quite close to 100mm (we’ll discuss the measuring accuracy later). Now let’s use plot scale – Fit to screen:

image4

What happened? The length of the line now relates to the page size in the .pdf file. So if we want to calculate length correctly, we should take into account the scale coefficient, which appeared when Fit to Screen was applied to the drawing plot settings (the same thing is of concern with other scale coefficients such as 1:2, 5:13, etc.). Now Teigha can do that. Just set the kMeasuring bit in PdfExportFlags:

params.setExportFlags(PDFExportParams::PDFExportFlags(PDFExportParams::kMeasuring));

Look at the result:

image5

We can see that the result of the measure is 99.97mm. What about the accuracy? The accuracy of the measurement depends on the geometry’s DPI. The greater the DPI, the greater the accuracy. So, change the default DPI (600) to at least 720:

image6

Here it is: 100mm.