This tutorial focuses on the process of how to convert PostScript file to PDF using C#. It has the configuration details, a list of tasks to be performed while writing this application, and a runnable sample code to convert PS to PDF using C#. A number of customization options are also discussed while converting the PS file to PDF.
Steps to Convert PS File to PDF using C#
- Set the IDE to use Aspose.Page for PS to PDF conversion
- Create an output stream for saving the output PDF file
- Create an input stream for reading the input PostScript file
- Create a PsDocument object using the input stream
- Create a PdfSaveOptions object by setting the suppress errors flag to true
- Create a PdfDevice object using the output stream
- Call the PsDocument.Save() method
These steps summarize the process to convert PostScript to PDF using C#. The process is commenced by creating the output PDF stream and a PS input stream followed by creating the PsDocument class object using the input PS stream. In the final steps, the PdfDevice object is created with the output stream, and the PsDocument object is saved into this stream using the specified properties of the PdfSaveOptions object.
Code to Convert PostScript File to PDF using C#
This sample code demonstrates the process for PS to PDF conversion using C#. The suppressErrors flag allows the conversion despite the errors during the conversion however the errors are saved in the PdfSaveOptions.Exceptions collection that can be iterated at the end to watch the errors if any. Similarly, you can set the folder where additional fonts are saved using the PdfSaveOptions.AdditionalFontsFolders property.
This tutorial has guided us in converting a file from PS to PDF using C#. If you want to learn converting an EPS file to PDF, refer to the article on how to convert EPS to PDF in C#.