See http://itextdocs.lowagie.com/tutorial/general/copystamp/index.html.

Paulo 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Michael Schierl
> Sent: Saturday, June 23, 2007 2:51 PM
> To: Post all your questions about iText here
> Subject: [iText-questions] How to preserve hyperlinks in 
> PdfImportedPage?
> 
> Hello,
> 
> when I try to resize PDF pages to put more than one of them 
> onto a page,
> all hyperlinks on the original pages get lost.
> 
> Any ideas how I could preserve them?
> 
> Example code (resizes just first page):
> 
> ------
> package jpdftweak;
> 
> import java.io.*;
> import com.lowagie.text.*;
> import com.lowagie.text.pdf.*;
> 
> public class HyperlinkKiller {
>       public static void main(String[] args) throws IOException,
>                       DocumentException {
>               PdfReader currentReader =
>                       new PdfReader("withlinks.pdf");
>               Document document = new Document();
>               PdfWriter writer = PdfWriter.getInstance(document,
>                               new FileOutputStream("scaled.pdf"));
>               Rectangle currentSize =
>                       currentReader.getPageSizeWithRotation(1);
>               document.setPageSize(currentSize);
>               document.open();
>               PdfContentByte cb = writer.getDirectContent();
>               PdfImportedPage page =
>                       writer.getImportedPage(currentReader, 1);
>               cb.addTemplate(page, 0.5f, 0, 0, 0.5f,
>                               0, currentSize.getHeight() / 2);
>               document.close();
>       }
> }
> ------
> 
> Example pdf: http://home.arcor.de/mschierlm/test/withlinks.pdf
> 
> Michael


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.


-------------------------------------------------------------------------
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
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