PDFBox - 可访问的 PDF - 如何根据可访问性指南检查 PDF 标签是否具有属性 [英] PDFBox - Accessible PDF - How to check if PDF Tags have properties as per Accessiblity guidelines

查看:59
本文介绍了PDFBox - 可访问的 PDF - 如何根据可访问性指南检查 PDF 标签是否具有属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要根据辅助功能指南检查 PDF 标签是否具有属性.示例:

Need to check if PDF Tags have properties as per Accessibility guidelines. Examples:

  • H1 - 验证 PDF 中是否存在 H1
  • Image(Figure Tag) - 验证 image\figure 是否有 Alt 文本
  • 语言 - 验证是否设置了语言属性,以便屏幕阅读器可以正确读取.对于西班牙语和英语文档,应更新各自的语言代码
  • 表格 - 访问表格对象并验证表格结构是否正确(标题列与行列匹配等)

到目前为止,我能够:

  • 通过PDDocument.getDocumentInformation().getMetadataKeys();
  • 提取元数据并验证文档是否具有正确的标题、主题和生产者信息
  • 通过检查PDDocument.getDocumentCatalog().getMarkInfo().isMarked();标志来验证PDF是否可访问
  • Extract the Metadata and validate the document has proper Title, Subject and Producer info by PDDocument.getDocumentInformation().getMetadataKeys();
  • Validate if PDF is accessible or not by checking PDDocument.getDocumentCatalog().getMarkInfo().isMarked(); flag

为了访问标签,我尝试了以下选项:

To access the Tags, I have tried these options:

  • getDocumentCatalog().getAcroForm() 返回 Null
  • PDDocument.getDocumentCatalog().getPages().get(0).getAnnotations(); 返回 Null
  • 我尝试遍历 PDDocument.getDocumentCatalog().getStructureTreeRoot().getKids() 但它只返回 1 个 StructElem 类型对象
  • getDocumentCatalog().getAcroForm() returns Null
  • PDDocument.getDocumentCatalog().getPages().get(0).getAnnotations(); returns Null
  • I tried looping through PDDocument.getDocumentCatalog().getStructureTreeRoot().getKids() but its returning only 1 StructElem type object

无障碍 PDF 的创建是使用 OpenText 完成的,因此开发团队不了解 PDFBox.我在这里迷失了如何访问标签/对象(使用 MarkedContent 或其他东西).

Creation of Accessible PDF is done using OpenText so Dev team doesn't know about PDFBox. I am lost here as how to get the access to Tags/Objects (use MarkedContent or something else).

请建议如何提取单个对象(标签),例如 P、H1、表格、图形/图像并验证它们的属性.注意:使用 Adob​​e Acrobat Pro 对这些属性进行手动验证

Please suggest how to extract the individual objects(tags) such as P, H1, Table, Figure/Image and validate their properties. Note: Manual validation of these properties are performed using Adobe Acrobat Pro

推荐答案

基于 https://issues.apache.org/jira/browse/PDFBOX-7,看来您可以使用 PDFMarkedContentExtractor 来获取您需要的信息.

Based upon https://issues.apache.org/jira/browse/PDFBOX-7, it appears that you can use PDFMarkedContentExtractor to get the information that you need.

这篇关于PDFBox - 可访问的 PDF - 如何根据可访问性指南检查 PDF 标签是否具有属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆