In fact, following this up myself, I think this might be more a general PDF 
issue, having also tried and failed to do what I want to do by manually 
inserting and extracting pages in Acrobat.

Googling, I found that this http://forums.adobe.com/message/2013939 describes 
the problem I am having.

It seems I cannot create an internal anchor reference in one PDF file and a 
corresponding internal anchor name in another PDF file and then merge the two 
files and get the anchor reference in what was the first file to go to the 
anchor name in what was the second file. I’m using Word 2007 to generate the 
PDFs and it works in MS Word (e.g. copying text with bookmark/links from one 
document to another) but seems not in PDF. So maybe internal anchors only work 
in the same PDF file. 

What I am actually trying to do is to preserve a Word table of contents 
hyperlink. It goes to a location like _toc1234567 so I thought if I added that 
as a destination anchor in a new PDF file, Word’s hyperlinked table of contents 
would go to that destination when I merged the PDF files.

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.

John

From: HJT Research 
Sent: Thursday, February 21, 2013 6:51 PM
To: itext-questions@lists.sourceforge.net 
Subject: [iText-questions] Adding a destination anchor to an existing PDFpage

Hi.

I am trying (and failing) to add an internal destination anchor to an existing 
PDF page so would be grateful for any help. I’m using iTextSharp (VB code so no 
semi-colons...).

I’ve tried:

Dim myAnchor As Anchor = New Anchor(anchorlink, Ar9FONT)
myAnchor .Name = anchorlink
col.SetSimpleColumn(myAnchor , left, bottom, right, top, 10, Element.ALIGN_LEFT)
col.Go()

But while the text of what I want to be the anchor is added to the page (i.e. 
the string ‘anchorlink’), it’s not acting as a destination when I click on a 
hyperlink in the PDF which goes to that location. 

If I try adding a link rather than a destination with .Reference such as: 

Dim myAnchor As Anchor = New Anchor(anchorlink, Ar9FONT)
myAnchor.Reference = "http://www.google.com/";
col.SetSimpleColumn(myAnchor, left, bottom, right, top, 10, Element.ALIGN_LEFT)
col.Go()

It works and the text is a clickable hyperlink. So SetSimpleColumn(myAnchor...) 
add anchors OK but maybe I am missing something regarding getting it to work 
with an internal destination? 

Thank you in advance for your time and assistance.

Jay



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