Hi Dipti,
Thanks for your response.
I indeed noticed the issue you mentioned. This issue has been logged into our bug tracking system with the ticket SPIREPDF-3326 for further investigation. If there is any update, we will inform you.
Besides, I found if you save the PdfDocument obejct to a stream after adding the footer, and then re-load the stream to add the TOC, the TOC of the final document is correct, as shown in the following code.
- Code: Select all
string[] files = { "File1.pdf", "File2.pdf", "File3.pdf" };
Stream stream = MergeFiles(files);
pdfDoc = new PdfDocument();
pdfDoc.LoadFromStream(stream);
//Add header image
pdfDoc = AddHeader(pdfDoc, 200, @"header1.png");
AddFooterAndPageNums(pdfDoc);
using (MemoryStream ms = new MemoryStream())
{
pdfDoc.SaveToStream(ms, Spire.Pdf.FileFormat.PDF);
PdfDocument pdf = new PdfDocument();
pdf.LoadFromStream(ms);
AddTableOfContent(pdf);
pdf.SaveToFile("out.pdf", Spire.Pdf.FileFormat.PDF);
}
Sincerely,
Rachel
E-iceblue support team