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

2023-07-07 06:32:00 Written by  support iceblue
Rate this item
(0 votes)

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.

Additional Info

  • tutorial_title:
Last modified on Friday, 07 July 2023 00:56