I'll tell you why it is problematic to achieve it in certain situations.
1) To print a PDF you will need to convert the PDF into the
printer-understandable input [ tough, given the varieties of printers
available ; and you will eventually reduce PDF to just a file storage
mechanism]. Not recommended given the fact that PDF rasterizers are
built with months of research and development and are usually expensive
to buy.
2) You can get programs like Ghostscript or Acrobat Reader to do the printing for you. These come with their own restrictions.
For eg: Adobe Acrobat Reader is known to print the PDF, but is unable
to terminate itself. In other words, you will see an empty acrobat
reader window open, after you have commanded it to print [ via Inter
Application Communication or DDE or AppletScript.....]. And when it
comes to Ghostscript , I doubt if many novices would like to install
such software.
3) You can embed _javascript_ code in the PDF file that will cause it to
do an automatic print followed by closure of the PDF document. This can
be subverted by disabling _javascript_ in Acrobat Reader / or any other
PDF Viewer.
4) Printing a PDF file delivered via a webpage is something that must
be forgotten altogether - it depends completely on how the user's
browser in configured. If the browser has a PDF plugin / helper app,
the PDF file will open in the browser window and you cant close the PDF
document programatically once it is opened. If the browser doesnt
have the PDF plugin, then the user will be prompted on how the PDF
document is to be handled [ open or save ].
5) You can writer your own browser helper application to automate the
printing. But it must be done for every browser and your users must
install the helper application.
6) You can display the PDF file within the browser using an applet,
which brings problems like presence of the Sun JRE/ MS JVM. The applet
must also be digitally signed so that it will have the security
permission to print the PDF file.
Moreover the applet contain code to print the PDF file via Java Print
Service - impossible considering that no one has written a PDF print
service provider for Java. Or the applet must reference commercial Java
libraries that can print the PDF file without any user intervention.
7) Open-source (yes I knew it would come to this) Java libraries may
not be well tested or lack the required features. You can try JPedal or
pdfbox.
I have given up trying to implement automated/silent printing after
discovering all these issues. Please dont waste any more time trying to
find out that extra bit that you feel might still be possible. If your
boss still insists, it is time to move on.
- Re: RE: [iText-questions] (no subject) Vineet Reynolds
- [iText-questions] (no subject) khalil bennis
- [iText-questions] (no subject) Maha Mohammed Nabeel Elmeseery
- Re: [iText-questions] (no subject) Paulo Soares
- [iText-questions] (no subject) ravi2082
- [iText-questions] (no subject) Isabelle Flückiger
- [iText-questions] (no subject) Gonzalez Charlez, Carlos
- Re: [iText-questions] (no subject) Bruno Lowagie
- [iText-questions] (no subject) Michael Kail
- RE: [iText-questions] (no subject) Paulo Soares
- [iText-questions] (no subject) Lakshmi Rajamani