3

In my company, we're looking for a way to convert a PDF document into a PCL (Printer Command Language) file in Java.

This is our workflow:

  1. Generate a PDF document in memory (meaning it's stored as a byte array)
  2. Convert the byte array into PCL, in memory or as a file
  3. Send that PCL file via FTP to a network printer

Issue Faced:

We cannot find a Java Library or native functionality to convert a byte array into a PCL file. How can this issue be overcome?

I know GhostScript is an option and it works fairly well on our own machines, but we won't be able to use that on the machine we're deploying on.

If there's some kind of library that can convert a PDF file or byte array into a PCL byte array or file, it would be of great help.

Dixon Chaudhary
  • 321
  • 1
  • 7
  • 21
  • Have you considered https://docs.oracle.com/javase/6/docs/technotes/guides/jps/spec/printing.fm2.html ? it can read in a PDF and export to PCL. – mlapaglia May 17 '18 at 16:43
  • Yes, we have. It might be the solution we need but the printer itself is not known to the deployment machine, which means Java doesn't know the print services that are associated with the device. Hence the need to convert into straight into a PCL file. The easiest way would be to register the printer on the deployment machine, but still. If it's possible to convert it straight into a PCL file, that would mean a lot less work for the people who maintain and configure our deployment machine, which is an IBM I series (AS/400). –  May 17 '18 at 16:52

1 Answers1

1

To come back to this question and to tell you our solution for an IBM I Series Machine:

We decided to install GhostScript using AIX (http://yips.idevcloud.com/wiki/index.php/pase/opensourcebinaries). Now, this isn't the ideal solution because for one, we didn't want to install any programs (jars are fine though) and second of all, it adds an extra step to our Java code base which wasn't planned because it adds RPG programming. There just doesn't seem to be any other way.

I hope this helps anyone who faces the same situation.