Michael Schierl wrote:
Thanks for your quick fix.

In SVN, I added a toString() for the imported link objects.

Unfortunately it still does not work for the original PDF (which is a bit
too large to attach it here). I managed to build a smaller PDF that shows
the same behaviour, this time when requesting the links for page 4. This
causes the same error as the one before, but the error remains in latest
SVN (3865) as well.

I tried the example, see attachment.

It works fine. This is what is returned:
Imported link: location [132.804 634.404 139.716 642.876] destination [33 0 R, /XYZ, 134.031738, 677.002, null] parameters {/C=[1, 0, 0], /Type=/Annot, /Border=[0, 0, 1], /Subtype=/Link, /H=/I} Imported link: location [140.484 634.404 147.516 642.876] destination [27 0 R, /XYZ, 134.031738, 677.002, null] parameters {/C=[1, 0, 0], /Type=/Annot, /Border=[0, 0, 1], /Subtype=/Link, /H=/I}

In other words: I can't reproduce the problem with your new file.

As for your other example that fails; did that ever work?

Take a look at the destinations: 33 0 R and 27 0 R refer to page dictionaries in the original file. What do you expect to happen when you copy those links to another document? There's no way anybody can guess to which page you want the copied links to point at.

I don't think your second problem was "introduced".
You could copy the links but you can't copy the parts 33 0 R and 27 0 R to a newly created document. It just doesn't make sense.
--
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info
import java.io.IOException;
import java.util.List;

import com.lowagie.text.DocumentException;
import com.lowagie.text.pdf.PdfReader;
import com.lowagie.text.pdf.RandomAccessFileOrArray;


public class TestChange {

        public static void main(String[] args) throws IOException, 
DocumentException {
                String filename = "pagefour.pdf";
                PdfReader currentReader = new PdfReader(new
                        RandomAccessFileOrArray(filename), new byte[0]);
                currentReader.consolidateNamedDestinations();
                List links = currentReader.getLinks(4);
                for (int i = 0; i < links.size(); i++) {
                        System.out.println(links.get(i));
                }
        }
}
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to