Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Java printing solution

Status
Not open for further replies.

rveina

Programmer
Aug 4, 2003
9
RO
Hello

I must develop a java application that must receive printing requests and print a document (probably PDF) to a printer. What solutions do I have ? What is the best approach for this kind of application ? Is there a way to send my generated PDF directly to a printer without actually opening it in a viewer ?
 
Hm, after reading it more closely I found sad things inside:

"Note: Just because the PDF DocFlavor exists doesn't mean you can use it to print a PDF file. When you lookup the PrintService for the PDF flavor, it will report unsupported flavor. That means there is no print service for the flavor. Sun doesn't provide one for PDF files. To the best of my knowledge, nobody else makes one available either. Until such a time as someone does, you can't print PDF files using the new Print Service API."

So, does anyone have an idea if there is somewhere such print service implemented ? Or any other solutions ? (maybe some non-java solutions?...)
 
In the (Dutch) Acrobat help file I found for a UNIX system :

cat sample.pdf | acroread -toPostScript | lp

to print from the command line.

acroread -help

should printout help about command line arguments.

But I don't think the windows version accepts command line arguments.
If you can find a pdf to postscript converter...
 
Hm, I saw once a tool that converts PDF to PS in Windows... but unfortunately we don't have printers that support PS here.

Well, anyway, I think we'll go for a different solution without PDF and using the Java Print API and probably describe our documents in a XML file. I found an interesting free tool (JFreeReport) which does something like this.

Thanks for your answers.
 
1. I was wondering whether you were generating the PDF documents with FOP (Since you are using XML). If so, you can also use FOP to generate PCL (or other) output and print that.

2. If you have an iSeries (AS/400) somewhere, from V5 on he can handle PDF. Ask the iSeries guys.
 
I tried to generate PCL with FOP but unfortunately it seems that FOP cannot add images in a PCL file, or at least it didn't work for me, and adding images is a very important issue for us.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top