How to Convert DGN to PDF in Java

This short tutorial focuses on how to convert DGN to PDF in Java by describing all the application configuration steps to use the library and develop an application. The output PDF can be further customized by setting the different rendering options exposed by the CadRasterizationOptions class. In the following example, during the process to change the DGN file to PDF in Java, we have set different rendering options to set the page size along with the other related options for the output PDF file.

Steps to Convert a File From DGN to PDF in Java

  1. Configure your project to include Aspose.CAD for Java from the Maven repository
  2. Using the load method exposed by the Image class, open the source DGN file
  3. Instantiate the CadRasterizationOptions class object to customize the rasterization of DGN file
  4. Create an instance of the PdfOptions class object to set the output PDF options
  5. Convert the DGN file to PDF using the save method

The above mentioned steps explain the process to convert DGN file to PDF in Java, where you will commence by loading the DGN file using the Image class object and subsequently saving that as a PDF file on the disk. If you intend to customize the rendering of the DGN file then you can use CadRasterizationOptions class object by setting the properties like page size, background and scaling of the output PDF.

Code to Convert DGN to PDF in Java

This code sample can be used to develop a DGN to PDF converter software in Java using a simple API interface. With the help of the CadRasterizationOptions class, you can customize the rasterization process by setting the page size, layouts in rendered PDF, draw color, background color, draw type, pen options, and quality.

In this topic, we have explored how to convert the DGN file to PDF in Java. If you want to learn about the process of converting DWF to PDF refer to the article how to Convert DWF to PDF in Java.

 English