1

I've been using the solution detailed in this question (including jLpr) to print PDF documents to a network printer. However, I've run into some problems with PDF version compatibility.

When I print documents that are PDF 1.4, it comes out fine. (To reproduce, create a simple text document in OpenOffice and export it to a PDF.) But when I print PDF 1.5 documents, the output is just jarbled text--no readable PDF.

It appears that jLpr isn't able to handle PDF 1.5 documents (either that or something is going wrong with the transmission or its decoding at the printer).

As in the question I referenced, I need a cross-platform solution with as few dependencies as possible. How can I get jLpr to work? Are there better ways to do it?

Community
  • 1
  • 1
Steve Nay
  • 2,819
  • 1
  • 30
  • 41
  • Is it the version of the PDF, or its contents? The "version" is just a byte near the front of the file: "%%PDF1.X" where X is some number between 0 and... 7. If tweaking that byte (in a hex editor if nothing else) fixes your problem, your printer driver is terrible. If not... something structural is causing your printer to puke. The version itself isn't the problem. – Mark Storer Dec 16 '10 at 00:22

2 Answers2

4

This has nothing to do with Java. The java library is just sending the PDF to your printer. And if your printer can't handle PDF 1.5, it can't handle 1.5. Javalpr isn't a postscript interpreter, it's just a network client for the LPR protocol for sending stuff to printers.

bmargulies
  • 97,814
  • 39
  • 186
  • 310
1

Java can't print PDF unless the printer supports PDF natively. You need to use a hack or a PDF renderign library to rasterize it. We wrote an article on PDF printing in Java at http://www.jpedal.org/PDFblog/2010/01/printing-pdf-files-from-java/

mark stephens
  • 3,205
  • 16
  • 19