Merging two Tagged PDF into one PDF using Aspose PDF

Hi,
I want to insert one PDF Doc2 after specific page of a first PDF Doc1. Both Doc1 and Doc2 are tagged PDFs.

I’m using following code to do that pdfEditor.insert(Doc1, 4, Doc2, 1,1, Doc3);
But,
Expected output: Doc3 should have tags of both Doc1 and Doc2.
Actual Result : Doc3 only have tags of Doc1 but not of Doc2.
Is there a way to insert the PDF and merge the tags as well.

@cvsformulary

Thank you for contacting support.

Would you please share source and generated files along with narrowed down code snippet and screenshots elaborating the problem, so that we may try to reproduce and investigate it. Before sharing requested data, please ensure using Aspose.PDF for Java 18.10.2 in your environment.

Hi Please find attached zip file Aspose question.zip (97.6 KB)

This zip file has:

  • InputFile1.pdf with tags
  • InputFile2.pdf with tags
  • FinalOutput.pdf created after inserting inputFile2 into inputFile1.

Result : Tags of FinalOutput.pdf does not have tags of inputFile2.

I used following code to insert the file:

String pdfStrdoc1 = new String(“Inputfile2.pdf”);
String pdfStrdoc2 = new String(“InputFile1.pdf”);
String pdfStrdoc3 = new String(“FinalOutput.pdf”);
PdfFileEditor pdfEditor = new PdfFileEditor();
pdfEditor.insert(pdfStrdoc2, 1, pdfStrdoc1, 1,1, pdfStrdoc3);

@cvsformulary

We have worked with the data shared by you and have been able to reproduce the issue in our environment. A ticket with ID PDFJAVA-38177 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.