Combining tagged PDF problem


I want to combine some pdfs with document structure tags (PDF/A-1a) to a single document this way:

    Document input1 = new Document(new ByteArrayInputStream(content1));
    Document input2 = new Document(new ByteArrayInputStream(content2));
    Document combinedDocument = new Document();
    combinedDocument.convert(new PdfFormatConversionOptions(PdfFormat.PDF_A_1A, ConvertErrorAction.Delete));"combined.pdf");

I would expect the combined.pdf to be PDF/A conform and contain document structure tags of the input documents.
But in fact, combined.pdf seems not to have any tags at all. If I show them in adobe acrobat, the application crashes.
What has to be done to preserve the document structure tags?

Attached are the input documents and the combined.pdf: (303.5 KB)


We have used the following code snippet with Aspose.PDF for Java 20.10 and generated the attached output PDF. Would you kindly check it and let us know what type of issues you see in it.

com.aspose.pdf.facades.PdfFileEditor pdfEditor = new com.aspose.pdf.facades.PdfFileEditor();
// array of files
String[] filesArray = new String[2];
filesArray[0] = dataDir + "input1.pdf";
filesArray[1] = dataDir + "input2.pdf";
// concatenate files
pdfEditor.concatenate(filesArray, dataDir + "output20.10.pdf");

output20.10.pdf (199.7 KB)

1 Like

No, there is no issue in the output pdf, it looks fine for this specific example, thank you.
I will test it in my environment, where the resulting output pdf must be conform to the pdf/a standard.

Would it be possible to get the same result without using the PdfFileEditor facade?


There is no alternative at the moment in order to merge two PDF documents with specified options. Please let us know in case you need further assistance.

Would there be an alternativ without the PDFFileEditor soon? We want to combine tagged PDF’s insert empty Pages an make Bookmarks and a TOC, the code is written with com.aspose.pdf.Document

and combinedDocument.getPages().add(input1.getPages()); like dvtdaten ask.

The code is functional some years and I would prefer not to change the whole code. But our customers need PDF UA as target. And now the tags are not applied.



A feature request as PDFJAVA-41361 has been logged in our issue tracking system to port the feature into DOM API. We have linked the ticket ID with this forum thread so that you will receive a notification as soon as it is resolved. Please be patient and spare us some time.

We are sorry for the inconvenience.

Are there any news about a possibile implemtentation. We need to plan our next software release.


The issue has been logged under free support model and will be investigated/resolved on a first come first serve basis. Regretfully, there has not been any progress made towards its resolution yet. We will surely inform you as soon as we have some certain updates about ticket resolution. Please be patient and spare us some time.

We apologize for your inconvenience.