Wrong order of tags when converting to PDF

Hi,

This is what we have to generate tags in PDF when it is converted from Word:

PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.setExportDocumentStructure(true);
             
pdfSaveOptions.setExportLanguageToSpanTag(true);
doc.save(outStream, pdfSaveOptions);

Some tags are in the wrong order.Capture.PNG (124.6 KB)
reviewWordDocument.pdf (166.6 KB)

When we try to save to PDF inside Word itself, it works fine. Can you help?

@Ligong Could you please attach your input document here for testing? We will check the issue and provide you more information.

SMITH_239001378_dismissal.docx (36.1 KB)
Please attached source Word file. Thanks.

@Ligong Thank you for additional information. Unfortunately, the problem is still not quite clear for me. I tried converting your document to PDF using MS Word and as I can see order of tags in the generated PDF document is the same as in PDF generated by Aspose.Words. The only difference is that content in the top of page is wrapped into additional P element in MS Word output. But the order of the paragraphs is the same. Could you please elaborate the problem in more details.

As you can see from attached image file “Capture.PNG”, “Office if Hearings Operation” is in the header but its tag appears in the middle of of the document.

I am attaching another image file. It shows that tag for “SOCIAL SECURITY ADMINISTRATION” in the same header also appears in the middle of the document, after paragraph “You must file your written appeal within 60 days”.

These tags will show in correct order if I use Word to save it into a PDF file.Capture2.PNG (82.7 KB)

Thanks.

@Ligong As I mentioned on my side the order of tags in PDF produced by MS Word is the same as in PDF produced by Aspose.Words. Please see the screenshot (MS Word generated PDF):

So as I can see Aspose.Words mimics MS Word behavior here. Could you please attach PDF document produced by MS Word on your side that shows the expected tags order?

Sorry you are correct. I tried again and see the same result from Word. Thanks.

1 Like