Knowledgebase (2417)
Children categories
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);
}
}
}

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.
Converting a PDF to PCL (Printer Command Language) in C# can be an essential task for developers working with printing solutions. PCL is a well-established page description language used by many laser printers, and converting documents into this format allows for more efficient and accurate printing.
In this article, we will explore the process of converting PDFs to PCL format in C# using Spire.PDF for .NET, including batch conversion for processing multiple files efficiently.
- • Install Spire.PDF for .NET
- • How to Convert PDF to PCL in C#
- • Batch Conversion of PDF to PCL using C#
Install Spire.PDF for .NET
To get started, you’ll need to install the Spire.PDF for .NET library in your project. The easiest way to do this is via NuGet.
- 1.Open “NuGet Package Manager” in Visual Studio.
- 2.Search for “Spire.PDF” and install the package.
Alternatively, you can run the following command in the Package Manager Console:
PM> Install-Package Spire.PDF
How to Convert PDF to PCL in C#
Once the Spire.PDF library is installed, you're ready to start converting PDF documents into PCL. The classes and methods used for conversion are explained below:
- PdfDocument: This class represents the PDF document you're working with.
- LoadFromFile(): This method loads the PDF file into the PdfDocument object.
- SaveToFile(): This method saves the loaded PDF document in the specified format (PCL in this case).
Code Example:
- C#
using Spire.Pdf;
namespace PDFtoPCL
{
class Program
{
static void Main(string[] args)
{
// Create a PdfDocument instance
PdfDocument pdf = new PdfDocument();
// Load a PDF file
pdf.LoadFromFile("Input1.pdf");
// Save to PCL format
pdf.SaveToFile("PdfToPcl.pcl", FileFormat.PCL);
pdf.Close();
}
}
}

Batch Conversion of PDF to PCL using C#
If you need to convert a large number of PDF files in a folder, you can perform batch conversion by following the below steps and code:
- 1. Get all PDF files in a specified folder using the Directory.GetFiles() method.
- 2. Use foreach loop to iterate over each PDF file.
- 3. Load each PDF file into the PdfDocument object.
- 4. Generate the output PCL file path, and then convert the PDF to PCL.
Code Example:
- C#
using Spire.Pdf;
using System.IO;
namespace PDFtoPCL
{
class Program
{
static void Main(string[] args)
{
string pdfFolder = @"F:\PDFs\";
string pclFolder = @"F:\PCLs\";
// Get all PDF files in a folder
string[] pdfFiles = Directory.GetFiles(pdfFolder, "*.pdf");
// Iterate through each PDF file
foreach (string pdfFile in pdfFiles)
{
// Load the PDF file into the PdfDocument object
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile(pdfFile);
// Define the file path and file name of the output PCL file
string outputFile = Path.Combine(pclFolder, Path.GetFileNameWithoutExtension(pdfFile) + ".pcl");
// Save PDF as PCL file
pdf.SaveToFile(outputFile, FileFormat.PCL);
pdf.Close();
}
}
}
}

Conclusion
With Spire.PDF for .NET, converting PDFs to PCL in C# becomes straightforward, whether you're handling individual files or bulk operations. Its robust API makes it an excellent choice for automating printing workflows or integrating conversion features into applications.
Get a Free License
To fully experience the capabilities of Spire.PDF for .NET without any evaluation limitations, you can request a free 30-day trial license.
PCL File is Digital printed document created in the Printer Command Language (more commonly referred to as PCL) page description language. From v7.1.19, Spire.Doc supports to convert word document to PCL. There are many kinds of standard for PCL document; the PCL here refers to PCL 6 (PCL 6 Enhanced or PCL XL). This article will show you how to save word document to PCL in C# and VB.NET by only three lines of codes.
using Spire.Doc;
namespace DOCPCL
{
class Program
{
static void Main(string[] args)
{
//load the sample document
Document doc = new Document();
doc.LoadFromFile("Sample.docx", FileFormat.Docx2010);
//save the document as a PCL file
doc.SaveToFile("Result.pcl", FileFormat.PCL);
}
}
}
Imports Spire.Doc
Namespace DOCPCL
Class Program
Private Shared Sub Main(args As String())
'load the sample document
Dim doc As New Document()
doc.LoadFromFile("Sample.docx", FileFormat.Docx2010)
'save the document as a PCL file
doc.SaveToFile("Result.pcl", FileFormat.PCL)
End Sub
End Class
End Namespace