GetPDFUADiagnosticsA
PDF/UA 與無障礙
Description
結尾的 A 表示 ANSI(char)DLL 進入點,ActiveX/COM 介面僅公開 Unicode 形式。其行為與 GetPDFUADiagnostics 相同,字串引數會依據目前的 SetAnsiMode 字碼頁進行解譯
傳回以換行分隔的清單,列出目前文件潛在的 PDF/UA-1 (ISO 14289-1) 符合性問題。每行一個問題代碼,後接冒號與人類可讀的描述。未偵測到問題時傳回空字串
語法
Delphi
Function DLGetPDFUADiagnosticsA(InstanceID: Integer): PAnsiChar;
DLL
const char * DLGetPDFUADiagnosticsA(int InstanceID);
Issue codes
| PDF-VERSION-LOW | 文件的 PDF 版本(記錄在檔頭)低於 1.7。PDF/UA-1 依 ISO 32000-1:2008(PDF 1.7)定義。呼叫 SetPDFUAMode 可自動把版本提升到 1.7。 |
|---|---|
| MARKED-FALSE | MarkInfo/Marked 未設為 true;文件不是標籤式 PDF。 |
| LANG-MISSING | The document catalog /Lang entry is absent or empty. ISO 14289-1 §7.3 requires a natural language declaration. |
| DISPLAYDOCTITLE-FALSE | ViewerPreferences/DisplayDocTitle is not true. Required by ISO 14289-1 §7.1 so the document title is shown in the title bar. |
| DOCINFO-TITLE-MISSING | 文件資訊字典的 /Title 項目不存在或為空。PDF/UA-1 要求文件必須有標題,輔助技術才能在文件開啟時朗讀。此檢查與 DISPLAYDOCTITLE-FALSE 互補:後者驗證標題有在檢視器中呈現;本檢查驗證標題值本身存在。請以鍵 Title 呼叫 SetInformation 設定。 |
| XMP-NO-PDFUAID | The XMP metadata stream does not contain a pdfuaid:part entry. Required by ISO 14289-1 §7.2. |
| ANNOT-NO-CONTENTS:N | N non-exempt annotations (excluding Widget, PrinterMark, and TrapNet subtypes) are missing a Contents entry. Required by ISO 14289-1 §7.18.1. |
| EMBED-NO-AFR:N | N embedded files are missing an AFRelationship entry in their file specification dictionary. Required by ISO 14289-1 §7.11. |
| FIGURE-NO-ALT:N | N Figure or Formula structure elements have no Alt text value. ISO 14289-1 §7.5 and ISO 32000-1 §14.9.3 require alternative descriptions for both graphical figures and mathematical formulas. |
| HEADING-LEVEL-SKIP:N | N heading level jumps were detected in document order (e.g. an H1 immediately followed by an H3, skipping H2). ISO 14289-1 §7.1 and WCAG 2.x Success Criterion 1.3.1 require headings to nest without gaps. |
| STRUCT-UNCLOSED:N | N 個結構元素仍處於開啟狀態,因為 EndTag 沒有呼叫正確次數。這些元素會從結構樹根中遺漏。 |
| TABLE-TH-NO-SCOPE:N | N TH (table header cell) structure elements have no Scope attribute. ISO 32000-1 §14.8.4.3.4 Table 337 defines Scope (Row, Column, or Both) as the attribute that describes which data cells each header cell applies to. Without it, assistive technology cannot reliably associate headers with data cells in complex or multi-header tables. Call SetStructElemScope (or AddTagAttribute with Owner='Table', Name='Scope') immediately after tagging each TH element. |
| FORM-NO-TOOLTIP:N | N interactive form fields (Widget annotations) are missing a TU (tooltip / accessible name) entry. ISO 14289-1 §7.18.4 requires all interactive form fields to carry a TU entry so assistive technology can announce the field's purpose to the user. /TU is the accessible name that screen readers read aloud; it is distinct from /T (the partial field name used programmatically). Set the TU value when creating or loading form fields. |
| LIST-STRUCT:N | N LI or LBody structure elements appear outside their required parent. ISO 32000-1 §14.8.4.4 requires LI to be a direct child of L (list), and LBody to be a direct child of LI (list item). Malformed list nesting prevents assistive technology from navigating lists correctly. Check the BeginTag / EndTag call sequence for all list-related elements. |
| ROLEMAP-UNMAPPED:N | N custom structure element types appear in the document but have no entry in the /RoleMap dictionary. ISO 14289-1 §7.1 and ISO 32000-1 §14.7.3 require that every non-standard structure type be mapped to a standard PDF type so assistive technology can determine how to handle the element. Call AddRoleMap for each custom type before saving. The issue description lists the unmapped type names. |
| SUSPECTS-TRUE | MarkInfo/Suspects is set to true. ISO 14289-1 §7.1 requires files claiming PDF/UA conformance to have a Suspects value of false. A true value marks the tagging as known to contain errors. Call SetMarkInfo after the document is fully tagged to reset Suspects to false. |
| ROLEMAP-STANDARD-REMAP:N | N standard structure types appear as the "custom" key in /RoleMap and would be remapped on save. ISO 14289-1 §7.1 forbids remapping standard tags defined in ISO 32000-1 §14.8.4 (P, H1..H6, Figure, Table, etc.). The detail line lists the offending standard tag names. Remove the affected AddRoleMap calls. |
| DC-TITLE-MISSING | The XMP metadata stream's Dublin Core dc:title is missing or empty. ISO 14289-1 §7.1 requires the Metadata stream to contain a dc:title entry that clearly identifies the document. This check is separate from DOCINFO-TITLE-MISSING, which only inspects the /Info /Title entry. Call SetPDFUAMode to copy the /Info title into the XMP packet. |
| TRAPNET-ANNOT:N | N TrapNet annotations were found on document pages. ISO 14289-1 §7.18.2 explicitly forbids TrapNet in PDF/UA-1 conforming files. Remove the offending annotations before saving. |
| ANNOT-PAGE-NO-TABS-S:N | N pages carry one or more annotations but their page dictionary does not set /Tabs /S. ISO 14289-1 §7.18.3 requires tab order on such pages to follow the structure tree, signalled by /Tabs /S. Set /Tabs /S in the page dictionary for every page that contains annotations. |
| ENCRYPT-NO-ACCESS | 文件已加密且 PDFUAMode 作用中,但加密 /P 權限鍵的位元 10(遮罩 $200,無障礙擷取)未設定。ISO 14289-1 §7.16 要求每個加密的符合檔案都允許無障礙擷取。在呼叫 Encrypt 之前先設定 PDFUAMode 時,該位元會自動強制開啟;呼叫順序顛倒時,加密字典已帶著舊 /P 值就位——請再呼叫一次 Encrypt 讓字典重新寫出。 |
| FIRST-HEADING-NOT-H1 | 文件順序中的第一個標題元素不是 H1(強結構的 H 哨兵也算第 1 級)。ISO 14289-1 §7.4.2 要求非強結構文件的第一個標題標籤為 H1。詳細行會指出違規層級。 |
| WIDGET-NO-STRUCTPARENT:N | N 個 Widget 註解缺少 /StructParent 項目。ISO 14289-1 §7.18.4 要求 Widget 註解巢狀在 Form 結構標籤內;沒有 /StructParent 時,結構樹根本找不到該 Widget。明細行會回報數量。這只是部分檢查——尚未完整驗證解析出的父項 /S 是否為 Form。 |
| LIST-NO-NUMBERING:N | N 個 L(清單)結構元素缺少 ListNumbering 屬性。ISO 14289-1 §7.6 要求每個 L 標籤以此屬性宣告編號方式(ISO 32000-1 Table 347 的有效值為 None、Disc、Circle、Square、Decimal、UpperRoman、LowerRoman、UpperAlpha、LowerAlpha)。開啟每個 L 標籤後請呼叫 SetStructElemListNumbering。 |
| MULTIPLE-H-CHILDREN:N | N structure tree nodes contain more than one direct H (generic heading) child. ISO 14289-1 §7.4.4 forbids that — split the parent section or replace the H tags with numbered H1..H6 sequences. |
Return value
以換行分隔的問題描述字串;若未偵測到合規問題則為空字串
Remarks
此函式是給開發者的診斷輔助工具。它檢查文件目前在記憶體中的狀態,回報可能導致 PDF/UA-1 驗證失敗的問題。載入或建構文件之後、儲存之前呼叫它,即可提前找出問題。
SetPDFUAMode 作用中且文件儲存時,若干問題(ANNOT-NO-CONTENTS、EMBED-NO-AFR)會在可能的範圍內自動修正;其餘問題由 GetPDFUADiagnostics 回報
此函式不修改文件。
範例
var
Diag: WideString;
begin
PDFlib.SetPDFUAMode('en-US');
// ... build document
Diag := PDFlib.GetPDFUADiagnostics;
if Diag <> '' then
ShowMessage('PDF/UA issues found:'#10 + Diag);
end;另見
SetPDFUAMode, SetDocumentLanguage, SetEmbeddedFileAFRelationship