Hi,
Using PDFSharp Nuget package, v 6.1.0, windows targeting .net 4.7.2
I have the code working to merge multiple PDF's together, but the accessibility tags that were present on the source PDF's no longer exist once it's merged. I noticed that when I tried pulling in a single document using PdfDocumentOpenMode.Modify, editing it individually, and then saving it off, the tags were still present in the output document, so seems specific to the merging code or Import mode.
Is there a way to merge PDF's together using either PDFSharp or MigraDoc while keeping the accessibility tags from the original documents intact?
Code:
//Each of the source documents are loaded from a byte array
var inFiles = new List<PdfDocument>(inputPDFs.Count);
foreach (var sourceBytes in inputPDFs)
{
stream = new MemoryStream(sourceBytes);
inFiles.Add(PdfReader.Open(stream, PdfDocumentOpenMode.Import));
}
// Then I loop through the source files and copy to the new doc
var document = new PdfDocument();
inFiles.ForEach(
pdfDocument =>
{
int count = pdfDocument.PageCount;
for (int idx = 0; idx < count; idx++)
{
PdfPage page = pdfDocument.Pages[idx];
document.AddPage(page);
}
});