NOW AVAILABLE: Summer 2025 Release
By Apryse | 2023 Oct 04
7 min
Tags
cad
conversion
Summary: CAD to PDF conversion provides a useful way to give access to CAD files for users without licenses or skills to use dedicated CAD software, or for archiving or review. Follow this guide to try CAD to PDF conversion in the Apryse SDK.
This blog was updated September 3, 2025.
The architecture, engineering and construction industry is a key focus area for Apryse software development. That’s why we’ve built our SDKs to support CAD workflows in your application such as:
In this article we will walk through the CAD To PDF sample and see how easy it is to perform this task with minimal code. We will also look at some of the features of the generated PDF when viewed within the Apryse WebViewer, such as:
While CAD software excels at design and editing tasks, sharing CAD files such as DWG, DXF, or RVT as-is can be impractical due to the files often being too large to share via email or web platforms, and the requirement of dedicated software and specific skills to interpret them.
Converting CAD files to PDF addresses these challenges effectively. PDF is a universally supported format that maintains the visual integrity of CAD designs while making them accessible to anyone with a PDF viewer. This simplifies collaboration, file sharing, and ensures that intricate details and precise measurements are accurately represented.
Designed with developers and businesses in mind, the Apryse SDK also offers a comprehensive solution for integrating CAD-to-PDF conversion directly into your applications or workflows.
Key Features:
The CAD2PDF sample code that we will be using can either be downloaded from here, or alternatively, the Apryse SDK is shipped with samples that demonstrate a wide range of functionality including CADtoPDF conversion. In either case, however, an add-on module is required, and we will show how to download and install that.
Before we can use the sample, however, we will need to get a Trial license key.
If you don't already have an Apryse account, go to https://dev.apryse.com and register a new account. This allows Apryse to grant you a demo license key which will be used with the Apryse SDK to enable demo functionality.
Figure 2 - The page for signing up to Apryse to get a Trial key
Log into https://dev.apryse.com with your registered account. The Apryse SDK and the CADToPDF module are available for Windows, Linux and macOS, so select the platform that you are using.
Click on the Reveal button to get your personalized Trial key.
The SDK does not include the CADToPDFModule which must be downloaded separately, which we will do next.
You can download the CAD module on the modules documentation page.
Extract the file over the folder that contains the SDK which you have previously extracted.
If you look inside the folder there should now be a file called CAD_README.md
Figure 7 - the Contents of the Apryse SDK folder after the addition of the CAD module.
A folder will also have been added to the Samples/TestFiles. This contains the CAD file used by the example code. If this folder is missing, then something has gone wrong with downloading, and extracting, the SDK and Module. This needs to be solved before continuing.
Figure 8 - The contents of the TestFiles folder. If this is missing then the CAD Module installation is not complete.
VSCode is an excellent option for looking at these files due to its efficient file viewing with syntax highlighting and git integration, however you can use whatever IDE you prefer.
Copy the license code that you have previously acquired into the PDFTronLicense class.
Figure 9 - The PDFTronLicense class indicating where your license key should be pasted.
Next, let’s look at the file that will do the work – CAD2PDFTest.cs.
Figure 10 - A view of the code used to set up the file for conversion.
You can see that the code has hard-coded file names. This is just to simplify setting up the project, so feel free to try it out with different files.
You can run the sample, which converts a specific CAD file to PDF, by navigating to navigate to the folder \PDFNetC64\Samples\CAD2PDFTest\CS then using RunTest.bat from a command prompt.
(Note that if you use a PowerShell terminal then you will need to use .\RunTest.bat, and if you use the Run command within VSCode then the working folder will be different, and you will need to change the relative paths accordingly.)
Figure 11 - Typical output of the RunTest.bat file.
Once the processing has completed, there will be a new file in the folder TestFiles\Output
Figure 12 - The Samples output folder after running the conversion.
This file can then be viewed in any PDF viewer, and shared with whoever needs to see it.
Figure 13 - An overview of the generated PDF.
Figure 14 - Detail of part of the PDF, zoomed into 19325%.
The behavior of the viewer is intuitive – it is exactly the same as you would use for any other PDF, so it is easy to zoom into any part of the file.
For a *.dwg file, the code is extremely simple – a PDFDoc object is created then saved:
using (PDFDoc pdfdoc = new PDFDoc()){
pdftron.PDF.Convert.FromCAD(pdfdoc, input_path + input_file_name, null);
pdfdoc.Save(output_path + output_file_name, SDFDoc.SaveOptions.e_remove_unused);
}
What is even better is that the code needed to do this is very similar to the code used to convert to and from Office, Image files etc. so that having learned to use the SDK, many other options are also, and easily, available.
Note: Revit files *.rvt, need a few more lines of code that set the page width and height and the RasterDPI. How to do this is included in the sample code, but the functionality is currently only available for Windows.
You can find more information on this package at
Whether you're an architect presenting plans to clients, an engineer sharing mechanical schematics, or an artist showcasing intricate designs, the Apryse SDK ensures that your creativity and innovation are never hindered by technical barriers. Embrace the power of streamlined CAD-to-PDF conversion and elevate your collaborative efforts to new heights.
In addition to converting CAD documents to PDF, Apryse offers many tools for editing and handling both Office Documents and PDFs, including converting PDFs into Office documents.
When you are ready to get started, see the documentation for the SDK to get started quickly. Don’t forget, you can also reach out to us on Discord if you have any issues, or contact Sales.
1. What is the easiest way to convert CAD files to PDF in a .NET application?
You can use the Apryse SDK to integrate CAD-to-PDF conversion directly into your .NET application. It supports formats like DWG, DXF, RVT, and more, with minimal code required.
2. Do I need CAD software or licenses to view or convert CAD files with Apryse?
No. Apryse SDK allows you to view and convert CAD files without needing any CAD software or licenses, making it ideal for scalable deployment.
3. What platforms support the Apryse CAD-to-PDF module?
The Apryse SDK and CADToPDF module are available for Windows, Linux, and macOS, enabling cross-platform development and deployment.
4. How can I get a trial license key for Apryse SDK?
You can get a trial key instantly at dev.apryse.com.
5. What features does the Apryse WebViewer offer for CAD?
Apryse WebViewer supports layer toggling, precise measurement tools, and deep zoom capabilities for intricate CAD details, enhancing collaboration and review.
Tags
cad
conversion
Apryse
Share this post
PRODUCTS
Platform Integrations
End User Applications
Popular Content