TOC in header: PDF output wrong


#1

Hi,

we have a customer who embedded the TOC inside the header of the first page. This generates a wrong output when rendering to PDF. I was able to reduce the problem to our code, which updates the page numbers for toc fields.

            var lic = new License();
            lic.SetLicense(@"S:\Aspose.Total.lic");

            var doc = new Document(@"S:\tmp\test.docx");

            // Inhaltsverzeichnis
            foreach (var fs in doc.GetChildNodes(NodeType.FieldStart, true).AsEnumerable().Cast<FieldStart>()
                .Where(fs => fs.FieldType == FieldType.FieldTOC))
                ((FieldToc)fs.GetField()).UpdatePageNumbers();

            doc.Save(@"S:\tmp\out.docx");
            doc.Save(@"S:\tmp\out.pdf");

Attached files:
test.docx -> reduced input file
out.docx -> above code saved to docx (output still is good)
out.pdf -> above code saved to PDF (output is wrong)
word.pdf -> PDF generated with word (from test.docx)

If you remove the loop, updating page numbers, the PDF generated with Aspose looks fine btw.

example.zip (1.1 MB)

Kind Regards,
Daniel


#2

@Serraniel

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-19138. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.


#3

Hi,

I noticed that the status of your internal issue has been Analysis Complete for a while now. Are there any results for a workaround we could do yet, or is this just an internal pending state on your site?

Kind Regards,
Daniel


#4

@Serraniel

Unfortunately, there is no workaround and news available on this issue. We will inform you via this forum thread once there is an update available on it. We apologize for your inconvenience.