How to Convert DGN to PDF in C#

This short tutorial entails the process of converting a DGN to PDF in C# by covering all the application configuration steps to use the library and write the application. The CadRasterizationOptions class can be used to customize the output PDF as per desired requirements. In the below given sample code to change the DGN file to PDF in C#, we have used the options to set the page size and other related options for the output PDF file.

Steps to Convert a File From DGN to PDF in C#

  1. Configure your project to include Aspose.CAD for .NET from the NuGet package manager
  2. Load the source DGN file in the Image class object
  3. Create an instance of CadRasterizationOptions class object to customize the rasterization of DGN file
  4. Create the PdfOptions class object to set the output PDF options
  5. Convert the DGN to PDF using the Save method

The aforementioned steps define the process that can convert DGN file to PDF in C#. The process starts by loading the DGN file using the Image class object and then saving that to a PDF file using the PdfOptions object as an argument with the default settings. If you want to customize the rasterization of the DGN file then you can use CadRasterizationOptions class object to customize the properties like setting the page size, background and scaling of the output PDF.

Code to Convert DGN to PDF in C#

This example can be used to write a DGN to PDF converter software in C# using simple API calls. The CadRasterizationOptions class can be used to customize the rasterization process like setting the layouts in rendered PDF, page size, background color, draw color, draw type, pen options, and quality.

In this topic, we learned to convert the DGN file to PDF in C#. If you are interested in the process of converting DWF to PDF refer to the article how to Convert DWF to PDF in C#.

 English