Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

Re: [iText-questions] problem combining dynamic
 contentwith  existingpdf

Paulo Soares

2007-08-03


That's possible with page reordering.

(About the other problem, you can't reuse a PdfDestination)

Paulo

----- Original Message -----
From: "m2barrett" <m2barrett@(protected)>
To: <itext-questions@(protected)>
Sent: Friday, August 03, 2007 6:44 PM
Subject: Re: [iText-questions] problem combining dynamic contentwith
existingpdf


>
>
> Is there any way to create a bunch of pages then go back to the first page
> and start using it? OR is there a way to insert a page that you are
> creating into a specific spot in the document that you are creating - for
> example: I create a new Document then i add a few pages to the Document,
> then add content to a new page and insert it at the beginning of the
> Document. Is this possible? Thanks for the help.
>
>
>
> Mark Storer-3 wrote:
>>
>> 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.