Hi Bruno,
Ok ill try to rephrase this. What I'm trying to do is to take an existing pdf
file and add javascript to it that
will popup a javascript alert when the document is opened as well as when its
closed.
I also want it to open the browser to a url of my choice when the pdf is
opened, and to
another url when the pdf is closed.
I have managed to use the pdf stamper to add javascript that shows a javascript
alert when the
document is opened. I need a code snippet that can achieve the other things I
needed.
Here is my code using stamper to show a javascript alert when the file is
opened.
Dim p As New PdfReader("c:\a.pdf")
Dim s As New PdfStamper(p, New FileStream("c:\b.pdf", FileMode.Create))
s.JavaScript = "app.alert(""Javascript Alert!"");"
s.Close()
I tried extending the PdfPageEventHelper but the onOpenDocument
uses the pdfwriter and document as arguments, so if I use the writer then
it assumes that its a new document, where as I need the code added to an
existing file.
I hope i could explain my situation more clearly this time...
Thanks in advance for your help.
Date: Tue, 17 Jul 2007 18:26:58 +0200
From: Bruno Lowagie <[EMAIL PROTECTED]>
Subject: Re: [iText-questions] onCloseDocument with itextsharp
To: Post all your questions about iText here
<[email protected]>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Satyajeet Hattangadi wrote:
> Could some one please provide me a code snippet that will display a
> javascript alert when the document is closed.
Search for "AdditionalAction" and PdfWriter.DOCUMENT_CLOSE.
> Also im sure its possible to open the browser to a url of choice
using
> pdfstamper, but I couldn't find enough documentation on it.
PdfStamper is a class for PDF manipulation.
I fail to see why it should be able to open
a browser to an URL. You'll have to rephrase
your question to explain what you mean.
br,
Bruno
---------------------------------
Ready for the edge of your seat? Check out tonight's top picks on Yahoo! TV. -------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/