By Date: <-- -->
By Thread: <-- -->

create external link in existing pdf



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 (at) lists.sourceforge.net 
> [mailto:itext-questions-bounces (at) lists.sourceforge.net] On 
> Behalf Of caveman1999
> Sent: Monday, November 06, 2006 9:22 PM
> To: itext-questions (at) 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 (at) 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 (at) lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions