Free Support Forum - aspose.com

Re: Add TOC in Existing PDF

Hi Ricky,


Thanks for contacting support.

Can you please share some sample application and resource files which can help us in replicating this problem in our environment. We are sorry for this inconvenience.

Hi Ricky,


Thanks for contacting support.

Can you please share some sample application and resource files which can help us in replicating this problem in our environment. We are sorry for this inconvenience.

Thank you for the response. Here is a slightly modified version of the example you originally posted. Notice if your input pdf file is 67 or more pages, the page linkage is thrown off (TOC links do not reach the correct destination).


I have attempted to calculate the TOC page size prior to inserting the TOC so that this line of code can be updated directly with the exact page in the new pdf. The links are still off.
// Specify the destination page for heading object
heading2.DestinationPage = doc.Pages[i + 2];

Any advice/examples on creating a TOC page considering a TOC that is larger than one page is much appreciated.

Hi Ricky,


Thanks for sharing the code snippet.

I have tested the scenario and have observed that when TOC increases more than one page, when selecting any link i.e. page 71, as a resultant, page 73 of PDF file is displayed. Are you facing similar issue. Please acknowledge so may further look into this matter.

Hello Nayyer,


Yes that is the exact behavior. The linkage for the TOC listings is not correct if the TOC grows beyond 1 page.

Thank you for your timely response,
Ricky

Hi Ricky,


Thanks for the acknowledgement.

I have logged this problem
as PDFNEWNET-37774 in our issue tracking system. We will further
look into the details of this problem and will keep you updated on the status
of correction. Please be patient and spare us little time. We are sorry for
this inconvenience.