This short tutorial describes the process of converting DWF to PDF in C# by sharing the application configuration to use the library and the stepwise approach to write this application. You can use the CadRasterizationOptions class to customize the output PDF according to your requirements. In the sample code to change the DWF file to PDF in C#, we have demonstrated the setting of the page size for the output PDF file.
Steps to Convert a File From DWF to PDF in C#
- Configure the project to add Aspose.CAD for .NET from the NuGet package manager
- Load the source DWF file in the Image class object
- Instantiate the CadRasterizationOptions class object to customize the rasterization
- Set the output PDF page size
- Declare the PdfOptions class object
- Set the VectorRasterizationOptions property of PdfOptions
- Save the PDF file using the PdfOptions object
These steps precisely define the process that can convert DWF file to PDF in C#. First, you have to load the DWF file into the Image class object and then save it using the PdfOptions object as an argument with the default settings. However, if you want to customize the rasterization of the DWF file then you may use CadRasterizationOptions class object and set a few properties like we set the page size of the output PDF.
Code to Convert DWF to PDF in C#
This code can be used to write a DWF to PDF converter software in C# as all the necessary classes and methods are introduced in it. The CadRasterizationOptions class is used to customize the rasterization process like the page size is set however, you can set other properties also like background color, draw color, draw type, layers, layouts, pen options, and quality to name a few.
This article has taught us to convert the DWF file to PDF in C#. If you want to learn the process to extract text from a DXF file refer to the article how to extract text from DXF file in C#.