Merge Pdf files delete accessibility tags

Hello,

When I’m merging two tagged pdf files
The merged file is loosing his tags.
Is there anything I can do with it?

here is my code
Document pdfDocument1 = new Document(“1.pdf”);
Document pdfDocument2 = new Document( “2.pdf”);
pdfDocument1.Pages.Add(pdfDocument2.Pages);
pdfDocument1.Save(“Merged.pdf”);

Thank you,

@yaronz

Please try using the below code snippet and let us know in case you still face any issue by sharing sample files with us:

Facades.PdfFileEditor pfe = new Facades.PdfFileEditor();
pfe.CopyLogicalStructure = true;
pfe.CopyOutlines = true;
//pfe.KeepActions = true;
pfe.Concatenate(dataDir + "1.pdf", dataDir + "2.pdf", dataDir + "result.pdf");

Hi,
Still the same, the result file is loosing tags.

I shared sample files, you can use PAC3 to see the accessibility results.2.pdf (1.1 MB)
1.pdf (749.2 KB)
ExpectedResult.pdf (1.0 MB)

please note that expectedResult.pdf is merged with 3 files.

@yaronz

We were able to replicate the issue in our environment while using Aspose.PDF for .NET 21.10. It has been noticed that the content of second file in the final merged document was not tagged any more. Therefore, an issue as PDFNET-50866 has been logged in our issue management system. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hi,

Still with this issue
is it possible to extract the tags (with ITaggedContent taggedContent = document.TaggedContent)
and after merge return the tags to the document?
if so, please share code.

Thanks

@yaronz

We are afraid that it is not possible to extract and preserve the tags to reassign in the PDF after merging. The ticket has also been not resolved yet due to other issues in the queue logged prior to it. However, we have recorded your concerns and will surely let you know as soon as we have some definite updates about ticket resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.