Hi paulo,

Thanks for replying.

The thing is that I had added javascript to fire when document opens but now
how do I do it. 
I am taking output streams and adding them as doc. I read the script from a
file and tried adding through addJavascript method but it giving some
errors.

So should I add javascript first then add doc or the sequence does not
matter.

Can you give me an example snippet to fire an event on doc open event.

Thanks

Manoj


Paulo Soares-3 wrote:
> 
> The removal of all javascript is intended. When joining several PDFs it's
> impossible to make sure that the javascript will still work. You can use
> PdfCopyFields.AddJavaScript() to add the javasript that you want to
> include.
> 
> Paulo 
> 
>> -----Original Message-----
>> From: Goel, Manoj [mailto:manoj.g...@boe.ca.gov] 
>> Sent: Friday, September 04, 2009 12:13 AM
>> To: itext-questions@lists.sourceforge.net
>> Subject: [iText-questions] PdfCopyFields looses Javascript
>> 
>> Hi All,
>> 
>>  
>> 
>> When merging pdf's using PdfCopyfields the javascript is 
>> lost. How can we get the javascript to work or fire automatically/
>> 
>>  
>> 
>> So I have code like this:
>> 
>>  
>> 
>>       ByteArrayOutputStream pdfBAOS = new ByteArrayOutputStream();
>> 
>>                     InputStream dataStream = 
>> externalContext.getResourceAsStream("/WEB-INF/PDF/mypdf");
>> 
>>                         reader = new PdfReader(dataStream);
>> 
>>                         stamper = new PdfStamper(reader,pdfBAOS);
>> 
>>                         AcroFields form = stamper.getAcroFields();
>> 
>>                         form.setField("registerOwner", registerOwner);
>> 
>>  
>> 
>>  
>> 
>> ......
>> 
>>  
>> 
>>   //now add this content to document
>> 
>>                         PdfReader currentReader = new 
>> PdfReader(pdfBAOS.toByteArray());
>> 
>>                         pdfCopyFields.addDocument(currentReader);
>> 
>>  
>> 
>>               by this time the javascript which fires at the 
>> open of pdf does not fire. I have defined an init method (not 
>> a s function) which has all the js to set color's of my text 
>> fields to gray.
>> 
>>  
>> 
>> If I don't have copyfileds call (i.e when showing single PDF) 
>> my js works fine but during copy the js does not fire, how 
>> can I get js to fire.
>> 
>>  
>> 
>> I tried to set the js at stamper level but does not work, 
>> please suggest a method.
>> 
>>  
>> 
>> Can I put a button hidden on the pdf and then fire the click 
>> event somehow on that button to run my script?
>> 
>>  
>> 
>> I am using Adobe Pro 9 to create my PDF's.
>> 
>>  
>> 
>> Please help
>> 
>>  
>> 
>> Thanks
>> 
>>  
>> 
>> Manoj
>> 
>>  
>> 
>> 
> 
> Aviso Legal:
> 
> Esta mensagem é destinada exclusivamente ao destinatário. Pode conter
> informação confidencial ou legalmente protegida. A incorrecta transmissão
> desta mensagem não significa a perca de confidencialidade. Se esta
> mensagem for recebida por engano, por favor envie-a de volta para o
> remetente e apague-a do seu sistema de imediato. É proibido a qualquer
> pessoa que não o destinatário de usar, revelar ou distribuir qualquer
> parte desta mensagem. 
> 
> 
> 
> Disclaimer:
> 
> This message is destined exclusively to the intended receiver. It may
> contain confidential or legally protected information. The incorrect
> transmission of this message does not mean the loss of its
> confidentiality. If this message is received by mistake, please send it
> back to the sender and delete it from your system immediately. It is
> forbidden to any person who is not the intended receiver to use,
> distribute or copy any part of this message.
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day 
> trial. Simplify your report design, integration and deployment - and focus
> on 
> what you do best, core application coding. Discover what's new with 
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 
> Buy the iText book: http://www.1t3xt.com/docs/book.php
> Check the site with examples before you ask questions:
> http://www.1t3xt.info/examples/
> You can also search the keywords list:
> http://1t3xt.info/tutorials/keywords/
> 

-- 
View this message in context: 
http://www.nabble.com/PdfCopyFields-looses-Javascript-tp25289794p25303128.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to