On Sat, 30 Jun 2007 17:23:41 +0200, Michael Schierl wrote:

> I will have a look if I can make up a general patch for itext to do things 
> like that - obviously links with their target in the same PDF will be 
> harder.

There is one more problem :(

I can get the links and get them into the target PDF just fine, I can
adjust the bounding box and the target point. I can also change the page
number.

But I don't manage to get the page number of the current target - I get a
PRIndirectReference, but how to make a page number from it?

Anyway, my current patch is attached.

The new function PdfReader#getLinks() will return an array of
PdfAnnotation.PdfImportedLink. This link knows if it is internal to the pdf
(#isInternal), and you can transform the bounding rectangle and the
destination point by a 2x3 matrix (the same matrix you used for tranforming
the pages with PdfContentByte#addTemplate(template,a,b,c,d,e,f)). These
PdfImportedLinks can later be converted to PdfAnnotation objects and added
to the PdfWriter (or discarded if the destination page is not in the new
PDF). Works fine here (tested with a bunch of PDF files) for external
links; internal links point to the correct relative position, but to the
wrong page (because I cannot get the page number).

TIA,

Michael
-- 
#!/usr/bin/perl -I' # tekscribble.pl - start in an xterm and scribble with mouse
$|=1;$g="\35";sub g{getc}sub [EMAIL PROTECTED]"stty 
-icanon";p"\233?38h";for(;;){
p"$g\33\32";$_=g;$x=g;$X=g;$y=g;$Y=g;last if/q/;$k=$y.chr((ord$Y)+64).$x.chr((
ord$X)+32);p"\33\14"if/c/;p$g.(/ì/?$l:$k).$k;$l=$k;}p"\33\3";system"stty icanon"

Attachment: keep-hyperlinks--unfinished.patch
Description: Attached file: keep-hyperlinks--unfinished.patch

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