Although AutoCAD provides precise measurement tools, PDF measuring tools are also necessary for architectural designs. PDF design drawings are often easier to view in construction sites and review processes while ensuring that the drawings remain unaltered.
In construction, review, approval, collaboration, and archiving, PDF measurement functionality remains essential. Follow this guide to build a PDF Measuring Tool.
What PDF Measuring Tools Does ComPDF Offer?
The ComPDF measurement feature allows you to measure PDF drawings precisely. Experience measurement PDF online demo and see the details.
-
Measure distance, angle, area, perimeter, line, rectangle, circle, polygon, multiline, arc.
-
Configure measurement properties like scale and precision.
-
Adjust Existing Measurement Annotations.
-
Set the appearance of the line and text to mark up the measurement results.
Step 1: Requirements - ComPDF Measurement for Windows
Before you start, ensure that you meet the following requirements:
-
Windows 7, 8, 10, and 11 (32-bit and 64-bit).
-
Visual Studio 2017 or higher (Make sure the .NET Desktop Development is installed).
-
.NET Framework 4.5 or higher.
-
Get a 30-day free trial license of ComPDFKit PDF SDK for Windows.
-
Download ComPDFKit PDF SDK for Windows from GitHub.
Step 2: Create a New Windows App Project
Create a new Windows application project in Visual Studio by clicking Create a new project.
Click WPF App (.NET Framework) —> Next.
Configure your project: Set your project name and choose the location to store your program. The project name is called "ComPDFKit Demo" in this example. This sample project uses .NET Framework 4.6.1 as the programming framework.
Click the Create button. Then, a new project will be created.
Step 3: Add ComPDF Measurement to Your Windows Project
You can add ComPDF measurement PDF SDK to your project by Nuget repository.
-
Open your project’s solution, and in the Solution Explorer, right-click on References and click on the menu item Manage NuGet Packages…. This will open the NuGet Package Manager for your solution.
-
Search for ComPDFKit.NetFramework and you’ll find the package on nuget.org.
-
On the right side, in the panel describing the package, click on the Install button to install the package.
-
Once that is complete, you’ll see a reference to the package in the Solution Explorer under References.
-
Add the Demo -> Measurement module of ComPDF to your project.
Step 4: Apply License for Your PDF Measuring Tool
Before using the measurement feature, you must get and apply for your ComPDFKit license. This ensures that all functionalities are unlocked and available for use.
You can find the license in an XML file which our sales send to you after you contact us. Open the XML file, and determine the license type based on the <type> field. If <type>online</type> is present, it indicates an online license. If <type>offline</type> is present, it indicates an offline license.
Online License:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<license version="1">
<platform>windows</platform>
<starttime>xxxxxxxx</starttime>
<endtime>xxxxxxxx</endtime>
<type>online</type>
<key>LICENSE_KEY</key>
</license>
Offline License:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<license version="1">
<platform>windows</platform>
<starttime>xxxxxxxx</starttime>
<endtime>xxxxxxxx</endtime>
<key>LICENSE_KEY</key>
</license>
Copy the value located at the LICENSE_KEY position within the <key>LICENSE_KEY</key> field. This is your license key.
Step 5: Configure Measurement Properties in C#
Before using the measurement feature, configure the scale, units, and precision settings. Here is a code example with the following configuration. You can adjust these settings based on your specific project needs.
-
Measurement Scale: 1.0 inch
-
Real-World Length Equivalent: 1.0 inch in the PDF equals 10.0 feet in the actual object.
-
Precision Setting: 0.01
MeasureSetting measureSetting = new MeasureSetting();
// Set the measurement scale in the PDF file to 1.0 inch.
measureSetting.RulerBase = 1.0;
measureSetting.RulerBaseUnit = CPDFMeasure.CPDF_IN;
// Set the translation of 1.0 inch in the PDF to correspond to 10.0 feet in the actual object.
measureSetting.RulerTranslate = 10.0;
measureSetting.RulerTranslateUnit = CPDFMeasure.CPDF_FT;
// Set the precision to 0.01.
measureSetting.Precision = CPDFMeasure.PRECISION_VALUE_TWO;
// (For enclosed graphics with measurable area) Set to display the area in the annotation appearance.
measureSetting.IsShowArea = true;
// (For enclosed graphics with measurable perimeter) Set to display the perimeter in the annotation appearance.
measureSetting.IsShowLength = true;
Additionally, ComPDF supports multiple measurement units, which can be adjusted accordingly.
If you have any questions when integrating ComPDF for Windows, please contact our support team or publish your questions on GitHub.
Step 6: Start to Measure Your PDF Drawings
Once everything is set up, your program will enable your users to measure PDF drawings with our Windows SDK. There is a video showing how to use the measurement functionality.
What’s More!
After integrating ComPDF measurement, you can also add other powerful features, such as:
-
Viewing
-
Annotations
-
Signatures
-
Document Comparison
By combining these features, you can create a complete workflow for PDF drawing measuring, reviewing, and approving within your application.