That "iterate through each page and import it into the Document object" is 
where you're going wrong.  While PdfCopy knows how to preserve links, the 
regular Document/PdfWriter combo does not.
 
I suspect you'll have to write your TOC document out as a seperate file (or 
memory stream), then use PdfCopy again.
 

--Mark Storer 
  Senior Software Engineer 
  Cardiff.com

#include <disclaimer> 
typedef std::Disclaimer<Cardiff> DisCard; 

-----Original Message-----
From: Digumarti, Swapna [mailto:swapna.diguma...@capgemini.com]
Sent: Monday, November 16, 2009 8:59 PM
To: iText-questions@lists.sourceforge.net
Subject: [iText-questions] Losing dynamic links after generating TOC .



 

 

Hi,

 

I am facing the following issue while merging two pdfs and then creating a toc.

 

The requirement is that I have to merge 2 existing pdfs(provided by client 
which may have internal/External links).

After these two pdf's are merged(I have used PdfCopy), I have to add a toc to 
it. The toc will have titles which are hardcoded,but the page number is 
generated dynamically.

I start off by creating the toc which returns me a Document object.

Then I iterate thru the pages of the merged document and import each page into 
the Document object.

In doing so,I am losing any dynamic external/internal url present in the 
initial 2 documents that I had merged.

PS:The links were not lost after the merge, they were lost only after the toc 
was added.

 

PFA the two merged pdfs along with the java main class and the output pdf.

 

Thanks in advance for the help.

 

Swapna.











This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is 

intended only for the person to whom it is addressed. If you are not the 
intended recipient, you are not authorized to 

read, print, retain, copy, disseminate, distribute, or use this message or any 
part thereof. If you receive this message 

in error, please notify the sender immediately and delete all copies of this 
message.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
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
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to