We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Document.TaggedContent throws "An item with the same key has already been added." exception


I have an issue with getting document.TaggedContent of a output file created by concatenating few documents on disk.
I have 3 PDF files placed on disk, where all 3 files are openable, have a TaggedContent available and pdfFileEditor.TryConcatenate returns true, but when I try to retrieve the TaggedContent from the output document I receive the following exception:
An item with the same key has already been added.”

Here’s the code snippet:

var inputFiles = new List<string>() {
var license = new Aspose.Pdf.License();

var outputFile = @"D:\TaggedContentIssue\output.pdf";

var pdfFileEditor = new PdfFileEditor()
	MergeDuplicateLayers = false,
	CopyOutlines = true,
	CopyLogicalStructure = true,
	KeepActions = false

pdfFileEditor.TryConcatenate(inputFiles.ToArray(), outputFile).Dump();

var outputDoc = new Aspose.Pdf.Document(outputFile);
var taggedContent = outputDoc.TaggedContent;

I attach 3 PDF documents that I used to concatenate with Aspose. Notice that after changing order of the document the exception is not thrown, but unfortunately it is not an available solution for us.

Best regards,
Artur JeżowskiTaggedContentIssue.zip (771.4 KB)

Thank you for writing to us and providing the code snippet and files to reproduce the exception.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-53738

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.