I'm afraid you're wrong. I 've already done a silent printing without any 
client confirmation. I just submit a form and the document printing is totally 
invisible for the client. You have to configure the target as an iframe with 
some attributes:

iframe:

ifrCachee=parent.document.createElement('<iframe name="printPdf" id="printPdf" 
src="about:blank" ></iframe>');
ifrCachee.height = 0;
ifrCachee.width = 5;
parent.document.appendChild(ifrCachee);

width must be >= 5 (why, I don't know) but height can be 0 so... invisibility

in the pdf generation:

//if acrobat 5.0 or more
pdf.getWriter().addJavaScript("this.print(false);",false);
//if acrobat 4.0
pdf.getWriter().addJavaScript("this.print(false,this.pageNum, 
this.numPages,false);",false);  

I think it's a security lack, but very useful for developers

Selon Bruno Lowagie <[EMAIL PROTECTED]>:

> David Pereira wrote:
> 
> >Can I print a PdfDocument from my servlet with IText?
> >
> A Servlet generates HTML/PDF/... that will be shown in a browser/viewer
> on the client. For security reasons, you can't program a way to print such a
> page automatically on a client printer. You can define an action to open a
> dialog box, asking the client if he wants to print the page, but that's all.
> If you want to print from a Servlet, you can only print to a printer 
> attached
> to the server. Carsten Hammer posted some code to do this a while ago
> (search the mailing list for lpr sources). I didn't have the time yet to 
> look
> at the code he sent.
> 
> br,
> Bruno
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: VM Ware
> With VMware you can run multiple operating systems on a single machine.
> WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
> same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 


-- 


-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to