Close

Relief for ODA Team in Ukraine

Learn more
ODA Drawings SDK
Export Measurement Data to PDF

There are two types of measuring for PDF export process represented with the PDFMeasuringType enumeration:

To retrieve the currently used measuring type, call the measuringType() method of the PDFExportParams class.

To set the measuring type, call the setMeasuringType() method of the PDFExportParams class.

Rectilinear Coordinate System Measurement

A drawing to be exported may include graphical entities that represent real-world objects. This means that the graphical entities contain specific information about scale and measurement units to store constant data about real-world objects and their relationship with units in user space of the output PDF file. Such information allows CAD applications to perform measurements that yield results in the units intended by the creator of the document. According to version 1.6 of the PDF format standard, measurement data can be stored in a PDF file.

For example, a drawing contains a line that is defined with two three-dimensional points: (1000, 1000, 0) and (1100, 1000, 0) and a rectangle around it. It is obvious that the real length of the line is 100 mm:

If you export this drawing to a PDF file with plot scale 1:1, and then apply a measuring tool in a PDF reader application, the length of the line is quite close to the original length, for example 99.9 mm.

However, if you use a Fit to Screen plot style for export, the length of the line in the output file has a significantly different value from the original (for example 93.05 mm). This happens because the length of the line depends on the output PDF file's page size. To keep the correct length, use a scale coefficient to recalculate the line length after applying the resizing operation.

To achieve this, you can use the kMeasuring flag, declared in the PDFExportFlags enumerator:

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

After setting the measuring scale flag, the line length in the PDF file is equal to or very close to the original value in the drawing.

To get better accuracy of the line length, use better resolution (DPI). For example, when accuracy is 600 dpi, the 100 mm length of the line can be converted to 99.97 mm. If you use 720 dpi or higher resolution, you will get exactly 100 mm length of the line.

Geospatial Coordinate System Measurement

The geospatial coordinate system measurement type is used when including geospatial data during PDF export. See Export Geospatial Data to PDF for details.

See Also

Set Parameters and Flags for PDF Export

Export Geospatial Data to PDF

Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.