Paulo,

Here is a code sample

                Document document = new Document();
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                PdfWriter writer = PdfWriter.getInstance(document, baos);
                Chunk link = new Chunk("<-- view page-->");
                link.setAction(PdfAction.javaScript("if(app.viewerVersion<7)
                {this.openURL(\"www.yahoo.com\",true);}
                     else{app.launchURL(\"www.ebay.com\",true);};",writer));
                PdfPCell cell = new PdfPCell(new Paragraph(link));

and the Stack trace.

[4/6/07 10:26:59:531 EDT] 00000025 SystemErr     R
java.lang.NullPointerException
[4/6/07 10:26:59:562 EDT] 00000025 SystemErr     R      at
com.lowagie.text.pdf.PdfWriter.addToBody(Unknown Source)
[4/6/07 10:26:59:562 EDT] 00000025 SystemErr     R      at
com.lowagie.text.pdf.PdfAction.javaScript(Unknown Source)
[4/6/07 10:26:59:562 EDT] 00000025 SystemErr     R      at
com.lowagie.text.pdf.PdfAction.javaScript(Unknown Source)

Regards,

Tom

>
>
> ________________________________
>
> De: [EMAIL PROTECTED] em nome de
> [EMAIL PROTECTED]
> Enviada: sex 06-Abr-07 15:13
> Para: iText-questions@lists.sourceforge.net
> Assunto: [iText-questions] opening url in new window
>
>
>
> Thank you for your help.
>
> I am attempting to add a link within the PDF to open a page on the same
> domain in a new window.  The following opens the link but in the same
> browser window.
>
> Chunk link = new Chunk("<-- view page -->");
> link.setAction(PdfAction.gotoRemotePage("http://mydomain/mypage","page1",false,true));
>
>
> It's up to the viewer to respect the new window flag.
>
>
> I have also been trying to do this with a PdfAction.javascript and
> app.launchURL but am getting a NullPointerException whenever my script
> reaches 100 characters.
>
>
> Please post a small code example so that the problem can be reproduced.
>
>
>
> Paulo
>
>
>
>
> Is it possible to open a link in a new window and if so, what way should
> I
> be going about it as I am obliviously doing something wrong.
>
> Regards.
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> Buy the iText book: http://itext.ugent.be/itext-in-action/
>
>
>
>
> 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.
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> Buy the iText book: http://itext.ugent.be/itext-in-action/
>


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to