That's not supported in PdfStamper but I'll make it work in the next release next week.
> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Annu Ittyachen Mathew > Sent: Friday, February 11, 2005 5:16 AM > To: [email protected] > Subject: RE: [iText-questions] Additional Actions not working > > Hello, > > If I use the code using a brand new document, then it is > working. But if I get the pdfwriter from a pdfstamper, then > it is not. I need the PdfStamper because I am making a copy > of the orginal document and inserting some modifications on that. > > This code Works: > PdfWriter writer = > PdfWriter.getInstance(document, new > FileOutputStream("c:\\form_text.pdf")); > document.open(); > writer.setPageEmpty(false); > writer.newPage(); > PdfAction oAction = > PdfAction.javaScript("app.alert(\"I'm here!\");\r",writer); > writer.setAdditionalAction(PdfName.WP,oAction); > document.close(); > This code doesnt work: > PdfReader oPdfReader = new PdfReader(strPdfFileName); > PdfStamper oPdfStamper = new PdfStamper(oPdfReader, > new FileOutputStream(strNewFileName)); > PdfWriter oPdfWriter = oPdfStamper.getWriter(); > PdfAction oAction = > PdfAction.javaScript("app.alert(\"I'm here!\");\r",oPdfWriter); > oPdfWriter.setAdditionalAction(PdfName.WP,oAction); > oPdfStamper.close(); > > > > At 10:20 AM 2/11/2005, Annu Ittyachen Mathew wrote: > > > At 08:33 PM 2/10/2005, Paulo Soares wrote: > > > Works for me. I used the code: > > PdfAction oAction = > PdfAction.javaScript("app.alert(\"I'm > here!\");\r",writer); > writer.setAdditionalAction(PdfName.WP,oAction); > > and I attach the resulting pdf that shows in my > Acrobat 6.0 in "Document > Will Print". > > > > -----Original Message----- > > From: Annu Ittyachen Mathew [ > mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ] > > Sent: Thursday, February 10, 2005 6:25 AM > > To: Paulo Soares > > Subject: Re: [iText-questions] Additional > Actions not working > > > > Thank you for the response. The javascript was just a > > placeholder. I will > > actually be calling a JS function that I > wrote. I insert > > these javascripts > > into the document using > PdfWriter.addJavaScript(). This works > > fine and all > > the JS is listed when I view it through > Tools->JavaScript->Document > > JavaScripts. Now I want to add a JS that will > be called when > > the document > > is about to be printed. For this I used the > code mentioned in > > the earlier > > mail. But funnily, the code doesnt work for > me. I viewed it through > > Tools->JavaScript->Set Document Actions menu > and nothing is > > listed there. I > > am using a PdfWriter obtained from a > PdfStamper for this. > > > > Any help is appreciated > > > > Thanks and Regards, > > Annu > > > > > > > > At 04:43 PM 2/9/2005, you wrote: > > >Yes it works. Go to Acrobat, list all > javascript and see it > > there. I've no > > >idea if your javascript makes any sense in > this context, though. > > > > > >----- Original Message ----- > > >From: "Annu Ittyachen Mathew" <[EMAIL PROTECTED]> > > >To: <[email protected]> > > >Sent: Tuesday, February 08, 2005 10:17 AM > > >Subject: [iText-questions] Additional > Actions not working > > > > > > > > > > Hi, > > > > > > > > I want to set a JS action when the > document is about to > > print. I used the > > > > code below > > > > > > > > PdfAction oAction = > > > > > PdfAction.javaScript("this.print(false);\r",oPdfWriter); > > > > > oPdfWriter.setAdditionalAction(PdfName.WP,oAction); > > > > > > > > However no such action is created. Am I > doing anything > > wrong. I would > > > > appreciate it if anyone can throw some > light on this > > > > > > > > Thank you, > > > > > > > > Regards, > > > > Annu > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > SF email is sponsored by - The IT Product Guide > > > > Read honest & candid reviews on hundreds > of IT Products > > from real users. > > > > Discover which products truly live up to > the hype. Start > > reading now. > > > > > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > <http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click> > > > > _______________________________________________ > > > > iText-questions mailing list > > > > [email protected] > > > > > https://lists.sourceforge.net/lists/listinfo/itext-questions > <https://lists.sourceforge.net/lists/listinfo/itext-questions> > > > > > > > > ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
