Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

Re: [iText-questions]
 problem combining dynamic content with  existingpdf

Mark Storer

2007-08-03

Replies:

Mark Storer <mstorer <at> cardiff.com> writes:

> Yep.
>
http://itext.svn.sourceforge.net/viewvc/itext/trunk/src/com/lowagie/text/pdf/PdfAction.java?revision=2526&view=markup:
>
>  457   public static PdfAction gotoLocalPage(int page, PdfDestination dest,
> PdfWriter writer) {
>  458      PdfIndirectReference ref = writer.getPageReference(page);
>  459      dest.addPage(ref);
>  460      PdfAction action = new PdfAction();
>  461      action.put(PdfName.S, PdfName.GOTO);
>  462      action.put(PdfName.D, dest);
>  463      return action;
>  464   }
>

Nope. My answer bothered me. If the getPageReferece return value was null,
none of your links would work. They won't take you anywhere... but they were
all taking you to the first page.

So I did a little digging. PdfWriter.getPageReference() will create references
to pages that don't exist yet. If there are more references than actual pages,
you get an exception when you close the document, but other than that it's
perfectly safe.

--Mark Storer
Senior Software Engineer
Cardiff.com

#include <disclaimer>
typedef std::disclaimer<Cardiff> Discard;


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/
©2008 junlu.com - Jax Systems, LLC, U.S.A.