How to Convert PostScript File to PDF using C#

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#

  1. Set the IDE to use Aspose.Page for PS to PDF conversion
  2. Create an output stream for saving the output PDF file
  3. Create an input stream for reading the input PostScript file
  4. Create a PsDocument object using the input stream
  5. Create a PdfSaveOptions object by setting the suppress errors flag to true
  6. Create a PdfDevice object using the output stream
  7. 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#.