Link to home
Start Free TrialLog in
Avatar of valipotor
valipotor

asked on

How to print a .pdf file from Java without using Adobe AcrobatReader (portable code) from an applet

Hi everybody,

I have an applet and i want to preview and print a .pdf file.
The applet must be platform independent, the file must be printed on one of the local printers, so the solution shouldn't be using acrobat reader.

10x

valipotor
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Avatar of Giant2
Giant2

Even PDF4Java:
http://sourceforge.net/projects/pdf4j

Bye, Giant.
Avatar of valipotor

ASKER

Hi Giant,

pdf4j - This project has not yet created any file release packages.

As for the first link, I was expecting a more precise info. The matter is of urgent nature, that's why i gave 500 points for this question.

Hi objects,
 I 'm now downloading pdfbox ... however, the lib has about 3MB. This can be a problem if used from an applet.

valipotor
Java libraries to read and write PDF files
http://schmidt.devlib.org/java/libraries-pdf.html
Hi hoomanv,
I am trying to print an exisiting pdf file to a printer, not create a pdf file.
And because i am writing an applet, i also need the .jar file to be small, let's say under 500k.

10x
SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi colr,

I need the posibility to control the print process. That is, after i have printed something, i have to mark the document as unmodifiable.
Using acrobat reader is no good, I must be able to determine if the user has printed the document or not.

And here are some other issues:

See the article at
http://princeoflightning.blogspot.com/2005/12/silent-print-pdf-print-pdf.html

One such product capable of doing that is the free Adobe Acrobat Reader. This well-known product does have it's limitations however. Command line options to print the PDF are undocumented / unsupported by Adobe. The Acrobat Reader process is known to start, print and continue running even after a silent print via command line; a bug that's not yet fixed by Adobe. Which means - you should expect to see a blank Acrobat Reader window after the "silent print". There are "beat around the bush" methods to attain certain amount of success using the commandline options - not for those who want "da perfect solution".
Inter Application Communication (IAC PDF reference file available at link) with the free Acrobat Reader cannot be done via OLE automation give the fact that Acrobat Reader is not a OLE server; you can get some luck only with Acrobat Standard or Pro. Only DDE messages can help a programmer write an application to achieve this. DDE will have restrictions that are not faced by an OLE Server. [If you don't know the difference then you musn't be doing this anyway].

Best regards,
valipotor
Is it not enough to assume that if the print button is pressed that the print will have occured? I take it you want to know for sure that the document has been printed, in that the button has been pressed and the paper has actually been ejected from the printer?

Would it be possible to simplify the process and ask the user if the print was succesfull?

An interesting problem...

colr__
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Giant2:
Nope, i don't want that. I want to be able to see if the button was pressed (and the confirmation dialog button, and so on ...), or if I use an external program such as Adobe then this is not possible.

That's why I wanted to try a silent print ... to be able to determine if the print has at least started.

colr_:
>>Would it be possible to simplify the process and ask the user if the print was succesfull?

This would mean to change the specs, this will be the last solution, if nothing else works.

valipotor
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi guys,

I haven't found anything that could solve my problem, so i decided to change the specs. I am now downloading the file to the local computer, and then , using JDIC I will launch the default viewer for the .pdf file.
The user will have to specify that the file was printed.

yeh, I think thats the best (only!) solution.

colr__