Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Problems with DocFlavor.INPUT_STREAM.PDF (printing PDFs)

807580Jun 18 2007 — edited Mar 17 2010
I've looked all around these forums, and all around the rest of the web, and from I can tell the best way to print a PDF document to a printer in Java is to use the javax.print.* (Java Print Service API stiff).

I have managed to write (well, piece together) code that allows me to print images with the DocFlavor.INPUT_STREAM.JPEG/GIF, however when I try to print anything else (PDF, PS, TEXT, etc) the PrintServiceLookup returns a big fat ZERO for the number of printers that can handle these formats. I don't understand why JPEG and GIF would work, but not plain TEXT_PLAIN_US_ASCII which I'd assume is almost as basic as you can get...

I am hoping for some insite, or some possible things to try. I am new to Java programming but as far as I can tell, the printer itself is being basically asked, "hey, can you print a document with this type and these settings (PrintRequestAttributeSet)?" My "printer" is a networked giant corperate laser printer and should be able to handle basically anything, I'd think...

I've also tried a newer printer and get the same results - JPEG and GIF work perfectly, but nothing else does!

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Apr 14 2010
Added on Jun 18 2007
10 comments
5,590 views