Hi Paulo
Thank you so much.
Regards
Khasim Rafiuddin L
ViLink Team
' Off: 510.645.3266
' Res: 510.481.5776
* [EMAIL PROTECTED]
----------------------------------------------------------------------------------------
This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery. NOTE: Regardless of content, this e-mail shall not operate to
bind CSC to any order or other contract unless pursuant to explicit written
agreement or government initiative expressly permitting the use of e-mail
for such purpose.
----------------------------------------------------------------------------------------
|---------+--------------------------->
| | "Paulo Soares" |
| | <psoares |
| | @consiste.pt> |
| | |
| | 10/11/2005 03:27|
| | PM |
| | Please respond |
| | to "Paulo |
| | Soares" |
|---------+--------------------------->
>-----------------------------------------------------------------------------------------------------------------------------|
|
|
| To: <[email protected]>, Khasim Rafiuddin
Lodge/FSG/[EMAIL PROTECTED] |
| cc:
|
| Subject: Re: [iText-questions] Can we Insert Java Script
programmatically into an existing PDF document using iText |
>-----------------------------------------------------------------------------------------------------------------------------|
PdfReader pdf = new PdfReader("mypdf.pdf");
PdfStamper stp = new PdfStamper(pdf, new FileOutputStream("outpdf.pdf"));
stp.addJavascript("app.alert(\"I'm here!\");\r");
stp.close();
----- Original Message -----
From: "Khasim Rafiuddin Lodge" <[EMAIL PROTECTED]>
To: "Paulo Soares" <[EMAIL PROTECTED]>;
<[email protected]>
Sent: Tuesday, October 11, 2005 10:31 PM
Subject: Re: [iText-questions] Can we Insert Java Script programmatically
into an existing PDF document using iText
>
>
>
>
> Hi Paulo
>
> Can you please send me a small code snippet that would be very helpful. I
> am not able to find documentation on iText thats one of the reasons for
> this erroneous code.
>
> Regards
> Khasim Rafiuddin L
> ViLink Team
> ' Off: 510.645.3266
> ' Res: 510.481.5776
> * [EMAIL PROTECTED]
>
>
>
>
--------------------------------------------------------------------------
--------------
>
> This is a PRIVATE message. If you are not the intended recipient, please
> delete without copying and kindly advise us by e-mail of the mistake in
> delivery. NOTE: Regardless of content, this e-mail shall not operate to
> bind CSC to any order or other contract unless pursuant to explicit
written
> agreement or government initiative expressly permitting the use of e-mail
> for such purpose.
>
--------------------------------------------------------------------------
--------------
>
>
>
>
> |---------+--------------------------->
> | | "Paulo Soares" |
> | | <psoares |
> | | @consiste.pt> |
> | | |
> | | 10/11/2005 02:02|
> | | PM |
> | | Please respond |
> | | to "Paulo |
> | | Soares" |
> |---------+--------------------------->
>
>---------------------------------------------------------------------------
--------------------------------------------------|
> |
|
> | To: <[email protected]>, Khasim
Rafiuddin Lodge/FSG/[EMAIL PROTECTED] |
> | cc:
|
> | Subject: Re: [iText-questions] Can we Insert Java Script
programmatically into an existing PDF document using iText |
>
>---------------------------------------------------------------------------
--------------------------------------------------|
>
>
>
>
> Your code is all wrong, you must use PdfStamper. Pdf is not postscript
you
> can't put one pdf after the other and expect to have something valid.
>
> ----- Original Message -----
> From: "Khasim Rafiuddin Lodge" <[EMAIL PROTECTED]>
> To: "Paulo Soares" <[EMAIL PROTECTED]>;
> <[email protected]>
> Sent: Tuesday, October 11, 2005 7:29 PM
> Subject: RE: [iText-questions] Can we Insert Java Script programmatically
> into an existing PDF document using iText
>
>
> >
> >
> >
> >
> > Hi Paulo
> >
> > Thank you very much for the prompt reply, but once I run this script
all
> > the original contents of the document are lost and the document becomes
> > blank and only the Java script remains in the document. So basically my
> > original contents of the document are gone once I insert JavaScript
into
> an
> > existing document using the iText api. Here is the Java class and the
PDF
> > for your reference
> > (See attached file: TestItext.java)(See attached file:
AviationRisk.pdf)
> >
> >
> > Regards
> > Khasim Rafiuddin L
> > ViLink Team
> > ' Off: 510.645.3266
> > ' Res: 510.481.5776
> > * [EMAIL PROTECTED]
> >
> >
> >
> >
>
--------------------------------------------------------------------------
> --------------
> >
> > This is a PRIVATE message. If you are not the intended recipient,
please
> > delete without copying and kindly advise us by e-mail of the mistake in
> > delivery. NOTE: Regardless of content, this e-mail shall not operate to
> > bind CSC to any order or other contract unless pursuant to explicit
> written
> > agreement or government initiative expressly permitting the use of
e-mail
> > for such purpose.
> >
>
--------------------------------------------------------------------------
> --------------
> >
> >
> >
> >
> > |---------+--------------------------->
> > | | "Paulo Soares" |
> > | | <psoares |
> > | | @consiste.pt> |
> > | | |
> > | | 10/11/2005 02:21|
> > | | AM |
> > |---------+--------------------------->
> >
>
>---------------------------------------------------------------------------
>
> --------------------------------------------------|
> > |
> |
> > | To: Khasim Rafiuddin Lodge/FSG/[EMAIL PROTECTED],
> <[email protected]> |
> > | cc:
> |
> > | Subject: RE: [iText-questions] Can we Insert Java Script
> programmatically into an existing PDF document using iText |
> >
>
>---------------------------------------------------------------------------
>
> --------------------------------------------------|
> >
> >
> >
> >
> > Works for me both in full Acrobat 6 and in Reader 6. Do you have
> > javascript enabled in Acrobat? (I attach my test file for you to check
> > out)
> >
> > > -----Original Message-----
> > > From: [EMAIL PROTECTED]
> > > [mailto:[EMAIL PROTECTED] On
> > > Behalf Of Khasim Rafiuddin Lodge
> > > Sent: Monday, October 10, 2005 9:35 PM
> > > To: [email protected]
> > > Subject: [iText-questions] Can we Insert Java Script
> > > programmatically into an existing PDF document using iText
> > >
> > >
> > >
> > >
> > >
> > > Hi
> > >
> > > Can we insert Java script into an existing PDF document using
> > > iText PDF
> > > library. If so how can we do that? We have tried the
> > > following but are not
> > > successful to do so on an existing PDF document.
> > > We are evaluating iText to fill existing PDF forms in our project.
> > > Currently our task is to insert JavaScript code into an existing PDF
> > > document.
> > >
> > > We are able to insert JavaScript to a new PDF document but
> > > unable to insert
> > > JavaScript to an existing PDF document.
> > > Please let me know if iText supports this feature and If
> > > "Yes", what is the
> > > best way to do so. Any code snippet will be helpful.
> > > Please Help.
> > >
> > > Here are the code snippets tried so far.
> > >
> > > FileInputStream fis=new
> > > FileInputStream("C:\\Project\\PDF
> > > -Open Src\\Test7.pdf");
> > > ByteArrayOutputStream bb=new
> > > ByteArrayOutputStream();
> > > readBuffer = new byte[bufferSize];
> > > while ((numRead = fis.read(readBuffer, 0,
> > > bufferSize))!=
> > > -1) {
> > > bb.write(readBuffer, 0, numRead);
> > > bb.flush();
> > > }
> > > readBuffer = null;
> > > fis.close();
> > > bb.close();
> > >
> > > com.lowagie.text.Document document = new
> > > com.lowagie.text.Document();
> > > PdfWriter writer =
> > > PdfWriter.getInstance(document, bb);
> > > document.open();
> > > writer.setPageEmpty(false);
> > >
> > > PdfAction oAction1 = PdfAction.javaScript(
> > > "app.alert(\"I'm here!\");\r",writer);
> > > writer.addJavaScript(oAction1);
> > > writer.addJavaScript("var
> > > debashis;appAlert('ok');");
> > >
> > > document.close();
> > > writer.close();
> > >
> > > FileOutputStream os1 = new
> > > FileOutputStream(new File(
> > > "C:\\Project\\PDF -Open Src\\Test7.pdf");
> > > os1.write(bb.toByteArray());
> > > os1.close();
> > >
> > > Also, If we use PdfStamper to insert javascript, it does not work.
> > >
> > > PdfReader reader = new PdfReader(fis);
> > > PdfStamper stamp=new PdfStamper(reader, bb);
> > > stamp.addJavaScript("var
> > > debashis;app.alert('ok');");
> > >
> > > Next thing, we tried to get PdfWriter from PdfStamper and insert
> > > Javascript, that also does not work. Basically, Inserting
> > > Javascript to an
> > > existing PDF does not work.
> > >
> > > PdfWriter wr = stamp.getWriter();
> > > PdfAction oAction1 = PdfAction.javaScript(
> > > "app.alert(\"I'm here!\");\r",wr);
> > >
> > > wr.addJavaScript(oAction1);
> > > wr.addJavaScript("var debashis;appAlert('ok');");
> > >
> > >
> > > Please Help !!!
> > >
> > >
> > >
> > > Regards
> > > Khasim Rafiuddin L
> > > ViLink Team
> > > ' Off: 510.645.3266
> > > ' Res: 510.481.5776
> > > * [EMAIL PROTECTED]
> > >
> > >
> > >
> > > --------------------------------------------------------------
> > > --------------------------
> > >
> > > This is a PRIVATE message. If you are not the intended
> > > recipient, please
> > > delete without copying and kindly advise us by e-mail of the
> > > mistake in
> > > delivery. NOTE: Regardless of content, this e-mail shall not
> > > operate to
> > > bind CSC to any order or other contract unless pursuant to
> > > explicit written
> > > agreement or government initiative expressly permitting the
> > > use of e-mail
> > > for such purpose.
> > > --------------------------------------------------------------
> > > --------------------------
> > >
> > >
> > >
> > >
> > > -------------------------------------------------------
> > > This SF.Net email is sponsored by:
> > > Power Architecture Resource Center: Free content, downloads,
> > > discussions,
> > > and more. http://solutions.newsforge.com/ibmarch.tmpl
> > > _______________________________________________
> > > iText-questions mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/itext-questions
> > >
> >
> > << Attachment Removed : original_check.pdf >>
>
>
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions