Jonathan,

 

Just let me put in my two cents here.

 

Acrobat Reader goes through frequent updates. Many clients have it set for
auto update, so you have little control of their version.  

 

If you are trying to do something that Leonard says is no longer supported,
you could save yourself a lot of time by trying to figure out another way
around the problem.  I have used in the past many "unsupported" command line
switches in AR and always been stung later with a version change that no
longer supports that particular switch.  The silent print option is one that
I think everyone would like to have, but for reasons explained by Leonard in
a post in the last month, Adobe no longer supports this (security risk?).

 

I fail to understand this reasoning by Adobe since the possibility of a
malicious bit of code printing reams of paper is not really much of a
"threat" in my book. But I am not Adobe and they may have many other
considerations that I am not aware of. I'm just happy they offer a free
Adobe Reader which makes my programming life easier in many other ways.

 

Personally, I went to using Ghostscript (free) that does officially support
its command line switches and where you can print silently to any printer.
So far, this has worked out well for my users who only have the extra hassle
of installing Ghostscript one time.

 

Rick

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jonathan
Richard
Sent: Friday, April 11, 2008 10:19 AM
To: [email protected]
Subject: Re: [iText-questions] silent print setpagesize problems

 

Hi Leonard

Thank you for your reply.

I am currently using Adobe Acrobat Reader 7.0.9; So I guess it should work
fine right?

Which method are you talking about exactly? this.print()? 

I created the javascript code based the javascript API from adobe version
8.1. April 2007; And everything I used can be found in that API.

Jonathan


>This method of silent printing has been disallowed by Acrobat/Reader
>8.1.1 and later.  You will need to present the print dialog.

>Leonard

>>On Apr 10, 2008, at 9:07 PM, Jonathan Richard wrote:

>> Hi
>>
>> I am using iText in a servlet to generate pdf and the silently
>> print this pdf in my web application.
>>
>> I call the servlet in a 1x1px iframe when clicking on the print
>> button. The javascript in the pdf is then executed and the it is
>> printed directly to the user's default printer without displaying
>> the print preferences window.
>>
>> The tricky part is that I need to print on a specific paper size:
>> A6. (about 4x6 inch)
>>
>> When generating the PDF, I use A6 as format:
>>
>> Document document = new Document(PageSize.A6, 0, 0, 20, 30);
>>
>> And, using the writer I add the JavaScript code to silently trigger
>> the print:
>>
>> String js = "";
>> js += "var pp = this.getPrintParams();\r\n";
>> js += "pp.interactive = pp.constants.interactionLevel.silent;\r\n";
>> js += "pp.colorOverride = pp.constants.colorOverrides.gray;\r\n";
>> js += "var fv = pp.constants.flagValues;\r\n";
>> js += "pp.flags = pp.flags | fv.setPageSize;\r\n";
>> js += "this.print(pp);" + "\r\n" + "this.closeDoc();\r\n";
>> writer.addJavaScript(js);
>>
>> On the HP LaserJet 1200 I got here, it works just fine. The printer
>> ajust the printing based on the paper size specified in the PDF
>> Document Object.
>> On a HP DeskJet 6840 it refuses to print. I can clearly see (in
>> Windows) request sent to the printer is of size: LETTER, 8.5x11.
>> Which is the default paper size of the printer.
>>
>> The printer will pull of piece of paper from the tray and then
>> check the size with a laser. Since it is not the proper size, it
>> will freeze and send an error.
>>
>> If I set the default paper size by hand to 4x6 inch in the printing
>> preferences it will work just fine. It works, but I want to avoid
>> to have to set manually the default printing size for 2 reasons:
>> - There is over 50 offices using this web application spread across
>> different cities, cofiguring them would be ... well... complicated.
>> - People might use these printers for other paper size.
>>
>> I don't understand why the flag is not taken in consideration.
>>
>> Has anyone got through this kind of problem? Is there any other
>> properties I could use to force the printer to print that PDF?
>>
>> Jonathan

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to