This discussion is archived
1 Reply Latest reply: Oct 22, 2012 5:14 PM by EJP RSS

Strange behaviour: printing pdf

Hurukan Newbie
Currently Being Moderated
Greetings,

I did a little application that is expected to print some pages from a pdf file that is modified by my application earlier in the process.
I got two or three pdf created that represents a single page.
I can read them (open) with Acrobat under Windows or Linux, print them without problem on both OS.

Problem is that if I use the printing services of Java, this only works on Linux ^^
I think it is because Linux uses a better implemented postscript driver than the one used on Windows.

I tried on two different printers: an HP (good'o laserjet 6L) and a more recent Samsung (forgotten the model).

With the HP the pages printed are like I have printed an executable -- printing junked characters (like this printer was unable to understand the PDF format and considers it is an executable)
With the Samsung it seems the driver detected the stream wasn't printable and freed the spooler without printing any page.

Is there a class that could help me format the stream sent to the printer in a printable format ?

I used DocFlavor.INPUT_STREAM.AUTOSENSE as well as DocFlavor.INPUT_STREAM.PDF or DocFlavor.INPUT_STREAM.POSTSCRIPT, it does the same on both printers.
I first implemented the Printable interface but I abandonned because I used the iText library to use an existing document in PDF that needed to be overlaped with datas generated by the application.
When using print(), it worked, but I had to draw myself the pages and it was too much work for the short deadlines I had.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points