Thank you for the replies.

I tried consolidateNamedDestinations() but it didn't work. Trying 
SimpleNamedDestination.ExportToXML(etc...) for the Word 2007 generated PDF 
gives an empty destination list so maybe Word isn't creating proper 
NamedDestinations and that is why.

Anyway, I see now from more Googling that this is possible by looping 
through the annotations on the Word table of contents pages (with 
PdfName.ANNOTS), checking which is a "/Link" and then looking at 
PdfName.DEST for each link.

And something like:

curAnnot.Remove(PdfName.DEST)
curAnnot.PutEx(PdfName.A, New PdfAction(PdfAction.NEXTPAGE))

will change a link in the Word table of contents to a link to the next page.

I have more to figure out in order to change NEXTPAGE to a GotoLocalPage for 
the correct page, but I can see that this is absolutely doable.

J


-----Original Message----- 
From: 1T3XT BVBA
Sent: Friday, February 22, 2013 12:37 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] Adding a destination anchor to an existing 
PDFpage

On 22/02/2013 12:46, HJT Research wrote:
> Would be grateful if anyone can think of a way to effectively mimic an
> anchor’s destination using iText, otherwise I’ll have to stick to PDF
> bookmarks as links.

If I recall correctly, PdfReader has a method named
consolidateNamedDestinations().
This replaces all the local named links with the actual destinations.
Would that be a solution for you? This way the names would disappear,
but the destinations would be preserved.

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a 
reference to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php 


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to