why

 doc.addJavaScript("this.print({bUI: true, bSilent:
false});\r")
doesnt work with me.

jun

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of chicks
Sent: Saturday, January 10, 2004 12:24 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [iText-questions] pdf print?!?


Many ways to do this.  The simplest is to add
JavaScript to the PDF that will print to the default
printer, or will open a print dialog:

<SNIP>
                // Check DisplayMethod parm
                String displayMethod =
request.getParameter("DisplayMethod");
                if (displayMethod.equals("printSilent"))
                {
                        // Add javascript to print to default printer
                        doc.addJavaScript("this.print({bUI: false, bSilent:
false});\r");
                }
                else if (displayMethod.equals("printDialog"))
                {
                        // Add javascript to pop up print dialog
                        doc.addJavaScript("this.print({bUI: true, bSilent:
false});\r");
                }

                // Close our document
                doc.close();

                // Tell the requestor what's coming
                response.setContentType("application/pdf");

                /***************** CRITICAL ************************
                 * IE may not open embedded Acrobat Reader 
                 * without being told the length of the datastream.
                 * M$ bug -- still not fixed in IE6.x
                
***************************************************/
                response.setContentLength(ba.size());

                // Send our filled PDF document back to requestor
                ServletOutputStream out =
response.getOutputStream();
                ba.writeTo(out);
                out.flush();
</SNIP>

<SNIP>
        public void addJavaScript(String jScript) {
                
                try
                {
                        PdfAction jAction = PdfAction.javaScript(jScript,
writer);
                        writer.addJavaScript(jAction);
                }
                catch (Exception e)
                {
                        System.err.println(e);
                }
        }
</SNIP>


__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus


-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to