原創(chuàng)|行業(yè)資訊|編輯:吉煒煒|2025-11-05 10:12:00.773|閱讀 1 次
概述:創(chuàng)建易于訪問且符合規(guī)范的 PDF 文檔正成為各行各業(yè)日益重要的需求。在本篇bow中,我們將探討如何使用 Text Control 的 .NET 庫驗證 PDF/UA 文檔,輕松確保生成的 PDF 符合無障礙標(biāo)準(zhǔn)。
#慧都22周年慶大促·界面/圖表報表/文檔/IDE/IOT/測試等千款熱門軟控件火熱促銷中>>
相關(guān)鏈接:
創(chuàng)建易于訪問且符合規(guī)范的 PDF 文檔正成為各行各業(yè)日益重要的需求。在本篇博文中,我們將探討如何使用 Text Control 的 .NET 庫驗證 PDF/UA 文檔,輕松確保生成的 PDF 符合無障礙標(biāo)準(zhǔn)。TX Text Control 34.0 將允許開發(fā)人員直接生成 PDF/UA 和 PDF/A-3a 文檔,這對于長期、合規(guī)的文檔歸檔而言是一項重大進(jìn)步。
PDF/UA(通用無障礙)制定了確保所有人都能訪問 PDF 文檔的標(biāo)準(zhǔn),包括使用輔助技術(shù)(如屏幕閱讀器)的用戶。
PDF/UA 確保文檔的結(jié)構(gòu)、閱讀順序和元素描述得到正確定義,以便所有內(nèi)容都能在語義上被理解。
另一方面,PDF/A-3a 是 ISO 標(biāo)準(zhǔn)化的歸檔 PDF 格式系列的一部分。它保證文檔可以原封不動地復(fù)制,包括嵌入式附件和可訪問內(nèi)容(“a”代表“可訪問性”)。
這兩個標(biāo)準(zhǔn)都要求文檔包含邏輯結(jié)構(gòu)、語義標(biāo)簽和準(zhǔn)確描述內(nèi)容的元數(shù)據(jù)。
在生成 PDF/UA 文件或設(shè)計模板的過程中,一些標(biāo)簽或描述性元素經(jīng)常會丟失或應(yīng)用錯誤。即使文檔在視覺上看起來沒有問題,但它可能不符合無障礙或存檔標(biāo)準(zhǔn),因此無法通過合規(guī)性檢查。
例如:
如果沒有驗證,這些問題很容易被忽視。
在 34.0 版本中,我們將引入一個驗證庫,旨在幫助開發(fā)人員檢查生成的 PDF 文檔的合規(guī)性。
該庫分析:
它以結(jié)構(gòu)化的 JSON 格式生成詳細(xì)報告,并為控制臺應(yīng)用程序提供文本輸出。這使得開發(fā)人員能夠?qū)Ⅱ炞C直接集成到自動化測試或質(zhì)量保證 (QA) 流程中。
以下是一個如何在 C# 應(yīng)用程序中使用驗證庫的簡單示例:
using TXTextControl.PDF.Validation;
var report = PdfUaValidator.Validate("documents/hyperlink.pdf");
report.PrintText();
在這個例子中,我們首先創(chuàng)建一個驗證器實(shí)例,然后驗證文檔。驗證結(jié)果會輸出到控制臺,并可以序列化為 JSON 格式以進(jìn)行進(jìn)一步分析。
生成的 JSON 報告詳細(xì)概述了文檔中發(fā)現(xiàn)的所有合規(guī)性問題:
{
"filePath": "documents/hyperlink.pdf",
"pdfVersion": "1.7",
"isPass": true,
"documentTitle": "This is a sample PDF/UA document",
"documentLanguage": "en-US",
"findings": [
{
"ruleId": "UA-CONFORMANCE",
"severity": "Info",
"passed": true,
"message": "PDF/UA-1 conformance declaration found in XMP."
},
{
"ruleId": "PDFA-CONFORMANCE",
"severity": "Info",
"passed": true,
"message": "PDF/A-3A declaration found in XMP."
},
{
"ruleId": "PDF-HEADER",
"severity": "Error",
"passed": true,
"message": "Found PDF header %PDF-1.7."
},
{
"ruleId": "PDF-XREF",
"severity": "Warning",
"passed": true,
"message": "Cross-reference table/stream appears present."
},
{
"ruleId": "UA-CATALOG",
"severity": "Error",
"passed": true,
"message": "Catalog dictionary present."
},
{
"ruleId": "UA-MARKED",
"severity": "Error",
"passed": true,
"message": "/MarkInfo \u003C\u003C /Marked true \u003E\u003E found (Tagged PDF)."
},
{
"ruleId": "UA-STRUCT",
"severity": "Error",
"passed": true,
"message": "/StructTreeRoot present."
},
{
"ruleId": "UA-MCID-ANCHOR",
"severity": "Info",
"passed": true,
"message": "Marked content (/MCID) present and at least one page has /StructParents anchors."
},
{
"ruleId": "UA-TEXT-MAPPING",
"severity": "Info",
"passed": true,
"message": "Font ToUnicode maps present (text is likely accessible)."
},
{
"ruleId": "UA-LANG",
"severity": "Error",
"passed": true,
"message": "/Lang present at document/page level."
},
{
"ruleId": "UA-METADATA",
"severity": "Warning",
"passed": true,
"message": "XMP metadata packet detected."
},
{
"ruleId": "UA-TITLE",
"severity": "Error",
"passed": true,
"message": "Document title found (Info or XMP dc:title)."
},
{
"ruleId": "UA-TABS",
"severity": "Warning",
"passed": true,
"message": "Page /Tabs setting present."
},
{
"ruleId": "UA-FIG-ALT",
"severity": "Info",
"passed": true,
"message": "Figures detected: 3; descriptive text tokens (/Alt or /ActualText): 3."
},
{
"ruleId": "UA-LINK-DESC",
"severity": "Info",
"passed": true,
"message": "Links: 2; all appear to have nearby tooltip/contents/ActualText."
},
{
"ruleId": "UA-FORMS-TU",
"severity": "Info",
"passed": true,
"message": "AcroForm detected; tooltips (/TU) count: 3."
},
{
"ruleId": "UA-TABLE-A-SUMMARY",
"severity": "Info",
"passed": true,
"message": "Tables: 3; all have /A with /Summary."
},
{
"ruleId": "UA-TABLE-HEADERS",
"severity": "Info",
"passed": true,
"message": "Tables with headers: OK=1, missing/invalid=0."
}
],
"tableSummaries": [
{
"index": 1,
"summaryText": "Table description",
"summaryRaw": "(\u00FE\u00FF\u0000T\u0000a\u0000b\u0000l\u0000e\u0000 \u0000d\u0000e\u0000s\u0000c\u0000r\u0000i\u0000p\u0000t\u0000i\u0000o\u0000n)",
"hasOTable": true,
"source": "Obj 58: A 74 0 R",
"thTotal": 3,
"thWithScope": 3,
"tdWithHeaders": 0,
"headersOk": true,
"headersApplicable": true
},
{
"index": 2,
"summaryText": "Inner table",
"summaryRaw": "(\u00FE\u00FF\u0000I\u0000n\u0000n\u0000e\u0000r\u0000 \u0000t\u0000a\u0000b\u0000l\u0000e)",
"hasOTable": true,
"source": "Obj 59: A 96 0 R",
"thTotal": 0,
"thWithScope": 0,
"tdWithHeaders": 0,
"headersOk": true,
"headersApplicable": false
},
{
"index": 3,
"summaryText": "Third table",
"summaryRaw": "(\u00FE\u00FF\u0000T\u0000h\u0000i\u0000r\u0000d\u0000 \u0000t\u0000a\u0000b\u0000l\u0000e)",
"hasOTable": true,
"source": "Obj 60: A 122 0 R",
"thTotal": 0,
"thWithScope": 0,
"tdWithHeaders": 0,
"headersOk": true,
"headersApplicable": false
}
],
"links": [
{
"index": 1,
"linkText": "Descriptive Text",
"linkTextRaw": "(\u00FE\u00FF\u0000D\u0000e\u0000s\u0000c\u0000r\u0000i\u0000p\u0000t\u0000i\u0000v\u0000e\u0000 \u0000T\u0000e\u0000x\u0000t)",
"targetType": "URI",
"targetValue": "http://www.textcontrol.com",
"targetRaw": "(//www.textcontrol.com)",
"source": "Annot window"
},
{
"index": 2,
"linkText": "Descriptive Text",
"linkTextRaw": "(\u00FE\u00FF\u0000D\u0000e\u0000s\u0000c\u0000r\u0000i\u0000p\u0000t\u0000i\u0000v\u0000e\u0000 \u0000T\u0000e\u0000x\u0000t)",
"targetType": "URI",
"targetValue": "http://www.textcontrol.com",
"targetRaw": "(//www.textcontrol.com)",
"source": "Annot window"
}
],
"figures": [
{
"index": 1,
"altText": "image in table",
"altRaw": "(\u00FE\u00FF\u0000i\u0000m\u0000a\u0000g\u0000e\u0000 \u0000i\u0000n\u0000 \u0000 \u0000t\u0000a\u0000b\u0000l\u0000e)",
"source": "Figure obj 55"
},
{
"index": 2,
"altText": "Barcode not in table",
"altRaw": "(\u00FE\u00FF\u0000B\u0000a\u0000r\u0000c\u0000o\u0000d\u0000e\u0000 \u0000n\u0000o\u0000t\u0000 \u0000i\u0000n\u0000 \u0000t\u0000a\u0000b\u0000l\u0000e)",
"source": "Figure obj 56"
},
{
"index": 3,
"altText": "Image description",
"altRaw": "(\u00FE\u00FF\u0000I\u0000m\u0000a\u0000g\u0000e\u0000 \u0000d\u0000e\u0000s\u0000c\u0000r\u0000i\u0000p\u0000t\u0000i\u0000o\u0000n)",
"source": "Figure obj 57"
}
],
"forms": [
{
"index": 1,
"fieldName": "list item",
"fieldNameRaw": "(list item)",
"fieldType": "Ch",
"tooltip": "list item",
"tooltipRaw": "(list item)",
"source": "Obj 10"
},
{
"index": 2,
"fieldName": "company_name",
"fieldNameRaw": "(company_name)",
"fieldType": "Tx",
"tooltip": "company_name",
"tooltipRaw": "(company_name)",
"source": "Obj 13"
},
{
"index": 3,
"fieldName": "is_client",
"fieldNameRaw": "(is_client)",
"fieldType": "Btn",
"tooltip": "is_client",
"tooltipRaw": "(is_client)",
"source": "Obj 15"
}
],
"standards": [
{
"standard": "PDF/UA",
"part": "1",
"conformance": null,
"source": "XMP"
},
{
"standard": "PDF/A",
"part": "3",
"conformance": "A",
"source": "XMP"
}
]
}
返回的Report對象提供了對驗證結(jié)果的結(jié)構(gòu)化訪問,使得集成到現(xiàn)有工作流程中變得容易。
即將發(fā)布的 TX Text Control 34.0 版本將為開發(fā)人員提供強(qiáng)大的工具,使他們能夠直接在 .NET 應(yīng)用程序中創(chuàng)建和驗證符合 PDF/UA 和 PDF/A-3a 標(biāo)準(zhǔn)的文檔。該驗證庫簡化了確保可訪問性和合規(guī)性的流程,使開發(fā)人員能夠自信地滿足行業(yè)標(biāo)準(zhǔn)。
--------------------------------------------------------------------------
關(guān)于慧都
慧都科技是一家行業(yè)數(shù)字化解決方案公司,長期專注于軟件、油氣與制造行業(yè)。公司基于深入的業(yè)務(wù)理解與管理洞察,以系統(tǒng)化的業(yè)務(wù)建模驅(qū)動技術(shù)落地,幫助企業(yè)實(shí)現(xiàn)智能化運(yùn)營與長期競爭優(yōu)勢。在軟件工程領(lǐng)域,我們提供開發(fā)控件、研發(fā)管理、代碼開發(fā)、部署運(yùn)維等軟件開發(fā)全鏈路所需的產(chǎn)品,提供正版授權(quán)采購、技術(shù)選型、個性化維保等服務(wù),幫助客戶實(shí)現(xiàn)技術(shù)合規(guī)、降本增效與風(fēng)險可控。慧都科技TX Text Control在中國的合作伙伴,提供TX Text Control系列產(chǎn)品免費(fèi)試用,咨詢,正版銷售等于一體的專業(yè)化服務(wù)。TX Text Control是文檔處理與管理領(lǐng)域的優(yōu)秀產(chǎn)品,幫助企業(yè)實(shí)現(xiàn)高效的文檔開發(fā)。
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@ke049m.cn
文章轉(zhuǎn)載自:慧都網(wǎng)