使用 Aspose dll 将 MarkInfo 条目元素添加到 PDF 文件的逻辑结构

Adding MarkInfo entry element to logical structure of a PDF file using Aspose dll's

我正在使用 Visual Studio 中最新的 Aspose.PDF DLL,并具有适当的(在应用的代码中)许可证。

我使用以下代码将 pdf 文件转换为 pdfa 类型:

Aspose.Pdf.Document pdf = new Aspose.Pdf.Document(pdfPath);     
bool converted = pdf.Convert(temptext, PdfFormat.PDF_A_1A, ConvertErrorAction.None);

现在我收到以下从临时文本 txt 文件中提取的错误:

<Problem Severity="Error" Clause="6.8.3.3" Convertable="True">Catalog shall have struct tree root entry</Problem>
<Problem Severity="Error" Clause="6.8.2.2" Convertable="True">Catalog shall have MarkInfo entry</Problem>

现在要在我的 PDF 文件的结构中获取 MarkInfo 条目,我应该能够将元素添加到目录或根结构(我不确定),这将使我能够创建这个PDF 文件逻辑结构的入口标签。 那么这两个错误就可以避免,PDFa文件就可以正确转换了。

我注意到 PDFSharp 通过以下方式用他们的 dll 解决了这个问题:

PdfSharp.Pdf.PdfDocument doc = PdfSharp.Pdf.IO.PdfReader.Open(pdfPath);
PdfSharp.Pdf.PdfDictionary structureTreeRoot = new PdfSharp.Pdf.PdfDictionary(doc);
structureTreeRoot.Elements["/StructElem"] = new PdfSharp.Pdf.PdfName("/Entry1"); 
PdfSharp.Pdf.PdfArray array = new PdfSharp.Pdf.PdfArray(doc);
doc.Internals.AddObject(structureTreeRoot);
doc.Internals.Catalog.Elements["/StructTreeRoot"] = PdfInternals.GetReference(structureTreeRoot);

我只想使用 Aspose dll。有谁知道我如何将它与 aspose dll 一起应用?

目前Aspose.Pdf不支持在PDF的逻辑结构中添加MarkInfo条目。请检查 forum thread 是否有类似问题。

我叫 Tilal Ahmad,我是 Aspose 的开发人员。