Hi i am bharath,
I want to know how to add custom page number in the table of content. I am able to add Table of Content but its auto generated for all the page, i want to know how to add custom table of content.
Please help me and explain the program…
Hi Bharath,
Thanks for contacting support.
As per my observations, the page numbers are properly being displayed against individual entry of TOC in attached TOC_Output.pdf. Do you mean to add PageNumber in Header/Footer area of the page ? If so is the case, then please follow the instructions specified over Add Page Number Stamp in a PDF File
In case I have not properly understood your requirement, please share some further details.
Thank for the reply.
But the requirement is, when we merge multiple PDF into one single PDF document, we want to add Page index to the document, Page index pointing to the files we added in the merge document as shown below.
Input Files : First.pdf, Second.pdf, Third.pdf
Output Single Merged File: Merge.pdf
We need page index as shown below in the output “Merge.pdf” file.
Index
1. First ------------------------------------------------------------------------------ 1
2. Second---------------------------------------------------------------------------10
3. Third------------------------------------------------------------------------------15
Thank in advanced
Hi Bharath,
Thanks for sharing the details.
Hi Bharath,
Can you please share your code snippet, so that we can test the scenario in our environment. We are sorry for this inconvenience.
Hi,
I have attached my C# code file, my input and output file please verify it. I need to add index page number into table of content.
1.Tableofcontent.txt file is my program file,
2.masterFileName.pdf file is my existing pdf file and also my input pdf file
3.TOC_Output.pdf file is Output file
Hi Bharath,
Thanks for sharing the source code. We will look into it and will update you our findings soon.
Best Regards,
Hi Bharath,
Thanks for sharing the details and sorry for the delayed response.
I have gone through the resource files and as per my observations, the TOC contains links towards second and third page of PDF document. I can see that umber 2 is specified for second page of PDF and number 3 is specified for third page of PDF file but I still wonder about your requirement to have page index in TOC. Isn’t the page number over which specific document starts is page index or you need some different behavior.
Furthermore, if you are concatenating multiple PDF files, you can use following approach to keep track of page index of newly added PDF file.
- Create an array to hold page count information.
- Load first PDF file and get page count and add value to array.
- Load another file and concatenate it with first file and get page count.
- add page count information to array.
- Load third file, concatenate with previously generated file and get page count.
- Add page count information in array.
- …
- …
- …
- create TOC with first entry equal to first page number.
- create TOC entry with page index as second array value + 1 (first PDF pages count + 1).
In case the above solution is not workable or I have not properly understood the page index concept in TOC, please share some sample resource file, so that we can again test the scenario in our environment. We are sorry for your inconvenience.