M
MattC
I want to use the Java Print Service(JPS) API to programatically send
PDF files to a printer. I need to send these files to the printer
without any user intervention.
I am able to print text files but have not been successfull in printing
PDF files. The error I recieve is "Invalid Flavor". Below are the
Document Flavors that my printer supports:
image/gif; class="[B"
image/gif; class="java.io.InputStream"
image/gif; class="java.net.URL"
image/jpeg; class="[B"
image/jpeg; class="java.io.InputStream"
image/jpeg; class="java.net.URL"
image/png; class="[B"
image/png; class="java.io.InputStream"
image/png; class="java.net.URL"
application/x-java-jvm-local-objectref; class="java.awt.print.Pageable"
application/x-java-jvm-local-objectref;
class="java.awt.print.Printable"
application/octet-stream; class="[B"
application/octet-stream; class="java.net.URL"
application/octet-stream; class="java.io.InputStream"
In addition to the above Flavors I have tried sending the PDF to the
printer using a Document Flavor of INPUT_STREAM.AUTOSENSE. When I do
this the PDF file gets sent to the printer but what actually gets
printed is garbage (control characters, overtyping, etc...).
It appears the printer does not directly support PDF printing. The
interesting thing is that I if I bring up a PDF file using Adobe Reader
and press the Print button the file does get printed successfully!
Can someone help me explain why Adobe Reader can print the file
successfully but I am unable to do it programattically? Can someone
suggest a different approach to take?
Thanks,
Matt
PDF files to a printer. I need to send these files to the printer
without any user intervention.
I am able to print text files but have not been successfull in printing
PDF files. The error I recieve is "Invalid Flavor". Below are the
Document Flavors that my printer supports:
image/gif; class="[B"
image/gif; class="java.io.InputStream"
image/gif; class="java.net.URL"
image/jpeg; class="[B"
image/jpeg; class="java.io.InputStream"
image/jpeg; class="java.net.URL"
image/png; class="[B"
image/png; class="java.io.InputStream"
image/png; class="java.net.URL"
application/x-java-jvm-local-objectref; class="java.awt.print.Pageable"
application/x-java-jvm-local-objectref;
class="java.awt.print.Printable"
application/octet-stream; class="[B"
application/octet-stream; class="java.net.URL"
application/octet-stream; class="java.io.InputStream"
In addition to the above Flavors I have tried sending the PDF to the
printer using a Document Flavor of INPUT_STREAM.AUTOSENSE. When I do
this the PDF file gets sent to the printer but what actually gets
printed is garbage (control characters, overtyping, etc...).
It appears the printer does not directly support PDF printing. The
interesting thing is that I if I bring up a PDF file using Adobe Reader
and press the Print button the file does get printed successfully!
Can someone help me explain why Adobe Reader can print the file
successfully but I am unable to do it programattically? Can someone
suggest a different approach to take?
Thanks,
Matt