C#/VB.NET: Convert PDF to PostScript (PS)

PostScript was developed by Adobe Systems in the 1980s as a way of turning digital graphics or text files into a fixed format ready for printing. With the passage time, although the PostScript (PS) file format is no longer as popular as it once was, now it is still supported by most printers. In this article, you will learn how to how to programmatically convert a PDF file to a PostScript (PS) file using Spire.PDF for .NET.

Install Spire.PDF for .NET

To begin with, you need to add the DLL files included in the Spire.PDF for.NET package as references in your .NET project. The DLL files can be either downloaded from this link or installed via NuGet.

PM> Install-Package Spire.PDF 

Convert PDF to PostScript in C# and VB.NET

Converting PDF to PS can improve the quality of the printed output. With Spire.PDF for .NET, you can complete the conversion with only three lines of code. The following are the detailed steps.

  • Create a PdfDocument instance.
  • Load a sample PDF file using PdfDocument.LoadFromFile() method.
  • Save the PDF file as a PS file using PdfDocument.SaveToFile(string filename, FileFormat.POSTSCRIPT) method.
  • C#
  • VB.NET
using Spire.Pdf;

namespace PDFtoPS
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create a PdfDocument instance
            PdfDocument document = new PdfDocument();

            //Load a sample PDF file
            document.LoadFromFile("Test.pdf");

            //Save the PDF file as a PS file
            document.SaveToFile("toPostScript.ps", FileFormat.POSTSCRIPT);
        }
    }
}

C#/VB.NET: Convert PDF to PostScript (PS)

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.