PDF printing in java
is there a way to print pdf files from a java webap开发者_JAVA百科plication on the local printer of the end user (connected via vpn)? The simple lookup of a printer via Java Printing Service always returns printer which are not able to print pdfs. Are there other libs which can be used for printing in java?
By the way, just opening the pdf in the browser is not an option, though it must be possible to run scheduled batch printing without user interaction.
Thanks in advance
Since the Java web application can't connect to the client (the client connects to it), there is no way to do this.
The only solution is to send the PDF file to the client via a download link or similar, so that the browser on the client can offer the user to save or print it.
I currently have the same problem - having to find a way to print PDF and Word documents. And the short answer is:
It's not as easy as you'd want it to be.
The problem is that "someone" has to do the interpretation of your document. And that someone is either the printer or you.
Not all printers support DocFlavor.x.PDF. We have four printers at my company (one was bought just last month) and none of them does. If you find a printer that does accept that DocFlavor you're done.
But since chances are the printer doesn't know what to do with a PDF file, you have to render the document yourself. I can recommend trying PDFRenderer and PDFBox. For me PDFRenderer works great and PDFBox doesn't print text correctly, but other people report the opposite. So, you will have to try for yourself.
All that still doesn't help me with Word docs, but that's not your concern.
精彩评论