Convert PDF to PCL in Java

Andrew Wilson
1 min readMay 16, 2022

PCL (Printer Command Language) is a page description language developed to provide efficient control of printer functions between various printing devices. This article will share how to programmatically convert PDF to PCL using Free Spire.PDF for Java (a totally free library for commercial and personal use).

Import JAR Dependency

Method 1: Download the free library and unzip it. Then add the Spire.Pdf.jar file to your project as dependency.
Method 2: Directly add the jar dependency to maven project by adding the following configurations to the pom.xml.

<repositories>
<repository>
<id>com.e-iceblue</id>
<name>e-iceblue</name>
<url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>e-iceblue</groupId>
<artifactId>spire.pdf.free</artifactId>
<version>5.1.0</version>
</dependency>
</dependencies>

Sample Code

To convert a PDF file to PCL, you can simply load a pdf document and then convert it to PCL using PdfDocument.saveToFile() method offered by Free Spire.PDF for Java.

import com.spire.pdf.*;

public class toPCL {
public static void main(String[] args) {

//Create a PdfDocument instance
PdfDocument doc = new PdfDocument();

//Load a pdf document
doc.loadFromFile("file1.pdf");

//Convert to pcl file
doc.saveToFile("ToPCL.pcl", FileFormat.PCL);
doc.close();
}
}

--

--

Andrew Wilson

Explore C#, Java and Python solutions for processing Word/Excel/PowerPoint/PDF files.