itext-questions  

Re: [iText-questions] Question abt itext silent printing

SVD
Thu, 15 May 2008 11:23:05 -0700

I am sorry, If I am nagging you all with this topic. But, we have a requirement 
to generate a pdf and store it in the specified directory and  silent printing 
to a named printer which may o may not be a default printer. I tried IText 
example for silent printing and it works fine and always prints to the default 
printer. I heard that using java script you can specify the printer name for 
silent printing.
   
  And I tried it with no luck. Here is my code
   
  StringBuffer javascript = new StringBuffer();
  javascript.append("var params= this.getPrintParams();");
  
javascript.append("params.interactive=params.constants.interactionLevel.silent;");
  javascript.append("params.pageHandling =params.constants.handling.shrink;");
  javascript.append("params.printername = \\\\ServerName\\PrinterName;");
  javascript.append("this.print(params);");
  
  writer.addJavaScript(javascript.toString(),false);
   
   
  Can you please help with this. It's kind of a urgent requirement.
   
  Thanks!

1T3XT info <[EMAIL PROTECTED]> wrote:
  SVD wrote:
> 1.Can we give the printer details like printer name and tray in the pdf 
> generation? Can you provide some code sample for this.

Do you know what the P in PDF stands for?
It stands for Portable; adding printer details would break
a PDFs portability. In the past there have been ways to
work around this, but they are discouraged.

> 2. Is it possible in itext to print on the client printer? I have a 
> requirement that when client clicks on print link it should print to the 
> client printer with out showing print dialogue.

Silent printing is possible with iText:
http://www.1t3xt.info/examples/browse/?page=example&id=266
BUT!!! As is explained in the iText book, silent printing
is a security hazard, and after the book was published Adobe
rightfully changed its policy and recent versions of Reader
demands user interaction before the document is printed.
In other words: you can't prevent the print dialogue to be
shown in recent versions of Adobe Reader.

Note that everything I say above is true regardless from
whether or not you are using iText.
-- 
This answer is provided by 1T3XT BVBA

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
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


       
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
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