create external link in existing pdf
- From: caveman1999 <caveman1999 (at) gmail.com>
- Date: Tue, 7 Nov 2006 03:41:08 -0800 (PST)
My bad...I failed to see that the 4 number parameters are the bottom-left and
top-right coordinates. I was thinking it was X,Y,Width,Height. RIF
(reading is fundamental).
Thanks for the help.
Paulo Soares wrote:
>
> You are doing it the correct way but you'll have to change the
> rectangle. Try:
>
> over.setAction(action,100f,100f,200f,200f);
>
> Paulo
>
>> -----Original Message-----
>> From: itext-questions-bounces@lists.sourceforge.net
>> [mailto:itext-questions-bounces@lists.sourceforge.net] On
>> Behalf Of caveman1999
>> Sent: Monday, November 06, 2006 9:22 PM
>> To: itext-questions@lists.sourceforge.net
>> Subject: [iText-questions] create external link in existing pdf
>>
>>
>> I am wanting to add an external link to an existing page from
>> a pdf. If I
>> understand it correctly, I use the PdfStamper object. In my
>> complete code,
>> I will calculate the X,Y coordinates & the width,height.
>>
>> Here is my code so far (it does not work)...
>>
>> import java.io.FileOutputStream;
>> import java.net.URL;
>>
>> import com.lowagie.text.Anchor;
>> import com.lowagie.text.Annotation;
>> import com.lowagie.text.Document;
>> import com.lowagie.text.Rectangle;
>> import com.lowagie.text.pdf.PdfAction;
>> import com.lowagie.text.pdf.PdfContentByte;
>> import com.lowagie.text.pdf.PdfReader;
>> import com.lowagie.text.pdf.PdfStamper;
>>
>> public class Main {
>>
>> public static void main(String[] args) {
>>
>> try {
>> PdfReader reader = new
>> PdfReader("c:\\data\\APlainTest.pdf");
>> int n = reader.getNumberOfPages();
>>
>> PdfStamper stamp = new PdfStamper(reader,new
>> FileOutputStream("c:\\data\\itext.pdf"));
>>
>> int i = 0;
>> PdfContentByte under;
>> PdfContentByte over;
>>
>> while (i < n) {
>> i++;
>>
>> //I don't know how to add this to the existing page, so I
>> tried a PdfAction,
>> that still did not work
>> Annotation a1 = new Annotation(100f,100f,100f,100f,new
>> URL("http://www.pubpress.com"));
>>
>>
>> under = stamp.getUnderContent(i);
>> PdfAction action = new
>> PdfAction(new URL("http://www.mytestsite.com"));
>>
>> under.setAction(action,100f,100f,100f,100f);
>>
>> over = stamp.getOverContent(i);
>>
>> over.setAction(action,100f,100f,100f,100f);
>>
>> }
>>
>> stamp.close();
>>
>> }
>> catch (Exception e) {
>>
>> }
>> }
>>
>> }
>>
>> --
>> View this message in context:
>> http://www.nabble.com/create-external-link-in-existing-pdf-tf2
>> 585177.html#a7207485
>> Sent from the iText - General mailing list archive at Nabble.com.
>>
>>
>> --------------------------------------------------------------
>> -----------
>> Using Tomcat but need to do more? Need to support web
>> services, security?
>> Get stuff done quickly with pre-integrated technology to make
>> your job easier
>> Download IBM WebSphere Application Server v.1.0.1 based on
>> Apache Geronimo
>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&
>> dat=121642
>> _______________________________________________
>> iText-questions mailing list
>> iText-questions@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>
>
>
> 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.
>
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
>
--
View this message in context: http://www.nabble.com/create-external-link-in-existing-pdf-tf2585177.html#a7216845
Sent from the iText - General mailing list archive at Nabble.com.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions