如何使用 IronPDF 在 C# 中建立符合 Section 508 標準且易於存取的 PDF 文件

This article was translated from English: Does it need improvement?
Translated
View the article in English

使用 IronPDF 在C# .NET產生可存取的 PDF,可產生符合 PDF/UA 標準的文檔,開箱即用,滿足Section 508WCAG 2.0 AA要求。 IronPDF 的 RenderHtmlAsPdfUA 方法會自動為從 HTML 生成的 PDF 檔案添加標籤式內容結構、閱讀順序、替代文字處理及無障礙元資料,讓 .NET 開發人員能為政府機關、醫療機構以及任何承接聯邦合約的組織,建立相容於螢幕閱讀器的文件。

TL;DR:快速入門指南

本教學涵蓋了在 C# .NET 中建立符合 Section 508 標準和 PDF/UA 可存取文檔,從標記結構產生到表單可存取性和合規性驗證。

-適用對象:政府合約、聯邦專案或醫療保健/教育系統中的 .NET 開發人員,這些專案依法需要 PDF 可訪問性。 -你將建立的功能:從 HTML 產生 PDF/UA、將舊版 PDF 轉換為 PDF/UA、語言標記、從語義 HTML 產生標記結構、圖像的替代文字、可存取的表格、書籤導航和帶有標籤的表單欄位。 -運行環境: .NET 10、.NET 8 LTS、.NET Framework 4.6.2+ 和 .NET Standard 2.0。 -何時使用此方法:當您的 PDF 必須通過第 508 節審核、PDF/UA(ISO 14289)驗證或 WCAG 2.0 AA 級要求。 -從技術角度來看,這很重要:標準 PDF 缺乏語義結構。 IronPDF 可以根據格式良好的 HTML 自動建立螢幕閱讀器所需的標籤的內容樹。

只需幾行程式碼即可建立符合第 508 條款的 PDF/UA 文件:

  1. 使用NuGet套件管理器安裝https://www.nuget.org/packages/IronPdf

    PM > Install-Package IronPdf
  2. 複製並運行這段程式碼。

    using IronPdf;
    
    ChromePdfRenderer renderer = new ChromePdfRenderer();
    PdfDocument pdf = renderer.RenderHtmlAsPdfUA("<html lang='en'><body><h1>Accessible PDF</h1></body></html>");
    pdf.SaveAs("accessible-document.pdf");
  3. 部署到您的生產環境進行測試

    今天就在您的專案中開始使用免費試用IronPDF

    arrow pointer

購買或註冊 IronPDF 的 30 天試用版後,請在應用程式開始時新增您的授權金鑰。

IronPdf.License.LicenseKey = "KEY";
IronPdf.License.LicenseKey = "KEY";
Imports IronPdf

IronPdf.License.LicenseKey = "KEY"
$vbLabelText   $csharpLabel

立即開始在您的項目中使用 IronPDF 並免費試用。

第一步:
green arrow pointer
NuGet 用 NuGet 安裝

PM >  Install-Package IronPdf

NuGet 查看 https://www.nuget.org/packages/IronPdf 以快速安裝。超過 1000 萬次下載,它正在用 C# 改變 PDF 開發。 您還可以下載 DLLWindows 安裝程序

目錄


什麼是第 508 條款合規性?為什麼它對 PDF 文件很重要?

第 508 條指的是 1998 年對 1973 年《康復法》的一項修正案。這項聯邦法律要求聯邦機構開發、採購、維護或使用的所有電子和資訊科技都必須對殘疾人無障礙。 其範圍不僅限於政府機關本身。 任何接受聯邦政府資助、與聯邦政府機構簽訂合約或向政府實體提供技術服務的組織也必須遵守規定。

其實際意義重大。 為聯邦醫療保健專案開發軟體的承包商不能僅僅交付螢幕上看起來正確的 PDF 報告。 這些文件必須能夠被螢幕閱讀器讀取,能夠透過鍵盤導航,其結構方式必須能夠被輔助技術解讀。 未能滿足這些要求可能會導致交付物被拒收、合約遺失,甚至可能面臨法律訴訟。

PDF文件在可訪問性方面面臨著獨特的挑戰。 與瀏覽器內建輔助功能渲染的 HTML 網頁不同,PDF 文件是獨立的文檔,必須包含自己的結構資訊。 如果 PDF 文件在視覺上看起來完美無瑕,但缺少正確的標籤、邏輯閱讀順序或圖像的替代文本,那麼對於依賴螢幕閱讀器的人來說,它可能完全無法使用。

不遵守規定的後果不僅限於法律風險。 製作難以取得文件的機構實際上排除了很大一部分受眾。 世界衛生組織統計,全球約有16%的人口患有某種形式的殘疾。 對於政府服務和聯邦資助計畫而言,將這些人排除在外不僅是糟糕的做法,而且是對公民權利保護的侵犯。

什麼是 PDF/UA 和 WCAG?它們與第 508 條有何關係?

了解不同無障礙標準之間的關係有助於明確開發人員實際需要實現的內容。 在討論無障礙 PDF 時,有三個關鍵標準相互交織:第 508 節、WCAG 和 PDF/UA。

Web 內容無障礙指南(通常稱為 WCAG)起源於萬維網聯盟。 這些指南確立了使數位內容可感知、可操作、可理解且穩健的原則。雖然 WCAG 主要針對網頁內容而設計,但其原則同樣適用於 PDF 文件。 2017 年更新的修訂版第 508 條標準直接將 WCAG 2.0 AA 等級作為合規性的技術基準。 這意味著滿足 WCAG 2.0 AA 要求實際上與滿足電子文件的第 508 條款要求相同。

PDF/UA,即 PDF/一般無障礙標準,是專為無障礙 PDF 文件設計的 ISO 標準(ISO 14289)。 WCAG 描述了無障礙內容應該達到的目標,而 PDF/UA 則規定了 PDF 檔案內部必須如何結構化才能實現這些目標。 該標準定義了標記內容、元資料、語言規範、替代文字和數十個其他技術要素的要求。

可以將這些標準視為互補的層次。 WCAG 規定了使用者所需的無障礙存取結果。 PDF/UA 提供了以 PDF 格式實現這些結果的技術規格。 第 508 條規定了遵守 WCAG 的法律要求,而 WCAG 又指出 PDF/UA 是 PDF 文件的實現途徑。

對開發者而言,實際意義顯而易見。 建置符合 PDF/UA 標準的文件符合第 508 節合規性的技術要求。 IronPDF 透過其內建的輔助功能處理了大部分此類複雜性,使您能夠專注於內容,而庫則管理底層 PDF 結構。

如何在 C# 中將現有 PDF 檔案轉換為 PDF/UA 格式?

許多組織都有大量現有的 PDF 文件庫,這些文件是在無障礙設計成為優先事項之前建立的。 IronPDF 讓您可以將標準 PDF 轉換為 PDF/UA 格式,而不是從頭開始重新建立這些文件。 此轉換過程會新增必要的標籤結構和元數據,以相容輔助技術。

轉換過程使用 SaveAsPdfUA 方法,該方法接受一個現有的 PdfDocument 物件並將其匯出為 PDF/UA 格式。 以下是一個完整的運行範例。

輸入 PDF 文件

在此範例中,我們使用 sample-document.pdf,這是一個不具備無障礙功能的標準 PDF 檔案,代表需要轉換的典型舊版文件。

以下程式碼使用 PdfDocument.FromFile() 載入現有 PDF 檔案,接著呼叫 SaveAsPdfUA() 匯出符合 PDF/UA-1 標準的新版本。 IronPDF 會自動分析文件結構,並新增所需的標記內容、元資料和輔助功能標記。

:path=/static-assets/pdf/content-code-examples/tutorials/accessible-pdfs-government-compliance/convert-to-pdfua.cs
using IronPdf;
using System;

string inputPath = "document.pdf";
string outputPath = "document-accessible.pdf";

// Load the existing PDF document
PdfDocument pdf = PdfDocument.FromFile(inputPath);

// Export as PDF/UA compliant document
// The method automatically adds required accessibility structure
pdf.SaveAsPdfUA(outputPath);

Console.WriteLine($"Successfully converted {inputPath} to PDF/UA format.");
Imports IronPdf
Imports System

Dim inputPath As String = "document.pdf"
Dim outputPath As String = "document-accessible.pdf"

' Load the existing PDF document
Dim pdf As PdfDocument = PdfDocument.FromFile(inputPath)

' Export as PDF/UA compliant document
' The method automatically adds required accessibility structure
pdf.SaveAsPdfUA(outputPath)

Console.WriteLine($"Successfully converted {inputPath} to PDF/UA format.")
$vbLabelText   $csharpLabel

對於原始透過 lang 屬性從 HTML 渲染而成的文件,其語言規格將保留在 PDF/UA 結構中。 以下範例展示語言標籤如何從 HTML 原始碼中保留下來。

輸入 PDF 文件

此範例使用 benefits-summary.pdf,這是一份需要進行無障礙轉換的效益說明文件,且須保留原始 HTML 來源的語言結構。

程式碼會載入 PDF 檔案,並呼叫 SaveAsPdfUA() 來進行轉換。 原始 HTML lang 屬性中的語言規格已保留於 PDF/UA 結構中,以確保螢幕閱讀器能使用正確的發音規則。

:path=/static-assets/pdf/content-code-examples/tutorials/accessible-pdfs-government-compliance/convert-with-language.cs
using IronPdf;
using System;

string inputPath = "document.pdf";
string outputPath = "document-accessible.pdf";

PdfDocument pdf = PdfDocument.FromFile(inputPath);

// Language is specified via the lang attribute in the HTML source.
// The PDF/UA structure preserves the language for screen readers.
pdf.SaveAsPdfUA(outputPath);

Console.WriteLine("Conversion complete with language specification.");
Imports IronPdf
Imports System

Module Program
    Sub Main()
        Dim inputPath As String = "document.pdf"
        Dim outputPath As String = "document-accessible.pdf"

        Dim pdf As PdfDocument = PdfDocument.FromFile(inputPath)

        ' Language is specified via the lang attribute in the HTML source.
        ' The PDF/UA structure preserves the language for screen readers.
        pdf.SaveAsPdfUA(outputPath)

        Console.WriteLine("Conversion complete with language specification.")
    End Sub
End Module
$vbLabelText   $csharpLabel

IronPDF 預設產生 PDF/UA-1 輸出,這是該標準廣泛採用的版本。 轉換過程會分析現有的 PDF 結構,並添加適當的標籤,用於標題、段落、清單和其他內容元素。 雖然自動轉換對於許多文件來說效果很好,但複雜的佈局或掃描影像可能需要額外的人工幹預才能完全符合規範。

如何將 HTML 直接渲染到可存取的 PDF/UA 文件中?

轉換現有 PDF 文件可以解決歷史遺留內容的問題,但新文件如果從一開始就考慮到可訪問性,將會受益匪淺。 IronPDF 的 RenderHtmlAsPdfUA 方法直接從HTML 輸入產生符合標準的輸出。 這種方法利用格式良好的 HTML 中已有的語意結構來建立結構良好的 PDF。

以下範例示範如何將 HTML 字串渲染為可存取的 PDF。

該程式碼會建立一個 ChromePdfRenderer 實例,並傳入包含標題與段落等語義元素的 HTML 字串來呼叫 RenderHtmlAsPdfUA()。渲染器會將 HTML 結構保留為 PDF 標籤,透過 MetaData.Title 設定文件標題,並儲存符合標準的輸出結果。 HTML 元素上的 lang='en' 屬性會保留至 PDF 文件中,供螢幕閱讀器進行語言偵測。

:path=/static-assets/pdf/content-code-examples/tutorials/accessible-pdfs-government-compliance/render-html-to-pdfua.cs
using IronPdf;
using System;

ChromePdfRenderer renderer = new ChromePdfRenderer();

string htmlContent = @"
<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='UTF-8'>
    <title>Quarterly Financial Report</title>
    <style>
        body { font-family: Arial, sans-serif; line-height: 1.6; }
        h1 { color: #333; }
        h2 { color: #555; margin-top: 20px; }
        p { margin-bottom: 15px; }
        table { border-collapse: collapse; width: 100%; margin: 20px 0; }
        th, td { border: 1px solid #ddd; padding: 12px; text-align: left; }
        th { background-color: #f4f4f4; }
    </style>
</head>
<body>
    <h1>Q4 2024 Financial Summary</h1>
    <p>This report provides an overview of financial performance for the fourth quarter.</p>

    <h2>Revenue Highlights</h2>
    <p>Total revenue increased by 12% compared to the previous quarter, driven primarily by expansion in the enterprise segment.</p>

    <h2>Expense Analysis</h2>
    <p>Operating expenses remained stable, with a slight reduction in administrative costs offset by increased investment in research and development.</p>
</body>
</html>";

// Render directly to PDF/UA format
PdfDocument pdf = renderer.RenderHtmlAsPdfUA(htmlContent);

// Set additional metadata for accessibility
pdf.MetaData.Title = "Q4 2024 Financial Summary";

pdf.SaveAs("financial-report-accessible.pdf");

Console.WriteLine("Accessible PDF created successfully.");
Imports IronPdf
Imports System

Dim renderer As New ChromePdfRenderer()

Dim htmlContent As String = "
<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='UTF-8'>
    <title>Quarterly Financial Report</title>
    <style>
        body { font-family: Arial, sans-serif; line-height: 1.6; }
        h1 { color: #333; }
        h2 { color: #555; margin-top: 20px; }
        p { margin-bottom: 15px; }
        table { border-collapse: collapse; width: 100%; margin: 20px 0; }
        th, td { border: 1px solid #ddd; padding: 12px; text-align: left; }
        th { background-color: #f4f4f4; }
    </style>
</head>
<body>
    <h1>Q4 2024 Financial Summary</h1>
    <p>This report provides an overview of financial performance for the fourth quarter.</p>

    <h2>Revenue Highlights</h2>
    <p>Total revenue increased by 12% compared to the previous quarter, driven primarily by expansion in the enterprise segment.</p>

    <h2>Expense Analysis</h2>
    <p>Operating expenses remained stable, with a slight reduction in administrative costs offset by increased investment in research and development.</p>
</body>
</html>"

' Render directly to PDF/UA format
Dim pdf As PdfDocument = renderer.RenderHtmlAsPdfUA(htmlContent)

' Set additional metadata for accessibility
pdf.MetaData.Title = "Q4 2024 Financial Summary"

pdf.SaveAs("financial-report-accessible.pdf")

Console.WriteLine("Accessible PDF created successfully.")
$vbLabelText   $csharpLabel

輸出 PDF

以上程式碼產生語意結構化的PDF/UA文件:

請注意,HTML 程式碼中包含 html 元素的 lang 屬性。 此屬性會傳遞到 PDF 檔案中,幫助螢幕閱讀器辨識文件語言。 語意化的 HTML 元素(如 h1、h2 和 p)直接轉換為對應的 PDF 標籤,從而建立輔助技術可以瀏覽的邏輯文件結構。

IronPDF 提供了一個對應的方法來渲染HTML 檔案URL而不是字串。

以下程式碼展示了兩種方法:RenderHtmlFileAsPdf() 從本地檔案路徑載入 HTML,而 RenderUrlAsPdf() 則從網頁 URL 擷取並渲染內容。 這兩種方法都會產生標準 PDF 檔案,隨後會使用 SaveAsPdfUA() 將其轉換為 PDF/UA 格式。 當您需要在進行輔助使用轉換之前套用額外的處理時,這種兩步驟法非常有效。

:path=/static-assets/pdf/content-code-examples/tutorials/accessible-pdfs-government-compliance/render-from-file-url.cs
using IronPdf;

ChromePdfRenderer renderer = new ChromePdfRenderer();

// Render from an HTML file on disk
PdfDocument pdfFromFile = renderer.RenderHtmlFileAsPdf("report.html");

// Convert the rendered PDF to PDF/UA format
pdfFromFile.SaveAsPdfUA("report-accessible.pdf");

// Render from a web URL
PdfDocument pdfFromUrl = renderer.RenderUrlAsPdf("https://example.com");

// Convert to accessible format
pdfFromUrl.SaveAsPdfUA("webpage-accessible.pdf");
Imports IronPdf

Dim renderer As New ChromePdfRenderer()

' Render from an HTML file on disk
Dim pdfFromFile As PdfDocument = renderer.RenderHtmlFileAsPdf("report.html")

' Convert the rendered PDF to PDF/UA format
pdfFromFile.SaveAsPdfUA("report-accessible.pdf")

' Render from a web URL
Dim pdfFromUrl As PdfDocument = renderer.RenderUrlAsPdf("https://example.com")

' Convert to accessible format
pdfFromUrl.SaveAsPdfUA("webpage-accessible.pdf")
$vbLabelText   $csharpLabel

如何設定文件元資料以符合無障礙存取要求?

PDF元資料在無障礙存取方面有多種用途。 輔助技術會播報文件屬性,例如標題和作者,以幫助使用者識別他們正在閱讀的內容。 搜尋引擎和文件管理系統使用元資料進行索引和檢索。 合規性驗證器會檢查所需的元資料欄位是否已填寫。

IronPDF透過 PdfDocument 物件的 MetaData 屬性公開元資料。 以下屬性與可訪問性最為相關。

輸入 PDF 文件

此範例採用 enrollment-guide-draft.pdf,這是一份福利註冊指南草案,需建立完整的元資料以符合無障礙規範並利於文件管理。

此程式碼載入現有 PDF 並設定所有關鍵元資料屬性:Creator(原始應用程式)以及時間戳記。 最後,SaveAsPdfUA() 會將文件連同元資料及 PDF/UA 無障礙結構一併匯出。

:path=/static-assets/pdf/content-code-examples/tutorials/accessible-pdfs-government-compliance/set-metadata.cs
using IronPdf;
using System;

PdfDocument pdf = PdfDocument.FromFile("document.pdf");

// Set the document title - critical for accessibility
// Screen readers announce this when opening the document
pdf.MetaData.Title = "Employee Benefits Enrollment Guide 2024";

// Author information helps identify document source
pdf.MetaData.Author = "Human Resources Department";

// Subject provides a brief description
pdf.MetaData.Subject = "Guide to selecting and enrolling in employee benefit programs";

// Keywords improve searchability
pdf.MetaData.Keywords = "benefits, enrollment, health insurance, retirement, HR";

// Creator identifies the originating application
pdf.MetaData.Creator = "Benefits Portal v3.2";

// Set document dates
pdf.MetaData.CreationDate = DateTime.Now;
pdf.MetaData.ModifiedDate = DateTime.Now;

// Save as PDF/UA with complete metadata
pdf.SaveAsPdfUA("document-accessible.pdf");

Console.WriteLine("Document metadata configured for accessibility.");
Imports IronPdf
Imports System

Dim pdf As PdfDocument = PdfDocument.FromFile("document.pdf")

' Set the document title - critical for accessibility
' Screen readers announce this when opening the document
pdf.MetaData.Title = "Employee Benefits Enrollment Guide 2024"

' Author information helps identify document source
pdf.MetaData.Author = "Human Resources Department"

' Subject provides a brief description
pdf.MetaData.Subject = "Guide to selecting and enrolling in employee benefit programs"

' Keywords improve searchability
pdf.MetaData.Keywords = "benefits, enrollment, health insurance, retirement, HR"

' Creator identifies the originating application
pdf.MetaData.Creator = "Benefits Portal v3.2"

' Set document dates
pdf.MetaData.CreationDate = DateTime.Now
pdf.MetaData.ModifiedDate = DateTime.Now

' Save as PDF/UA with complete metadata
pdf.SaveAsPdfUA("document-accessible.pdf")

Console.WriteLine("Document metadata configured for accessibility.")
$vbLabelText   $csharpLabel

產權性質值得特別關注。 PDF 閱讀器可以在標題列和標籤頁中顯示檔案名稱或文件標題。 為了便於閱讀,應該顯示文件標題,因為它提供了有意義的上下文。 像"2024 年員工福利登記指南"這樣的標題遠比像"doc_final_v3_revised.pdf"這樣的檔案名稱更有用。

從 HTML 建立新的 PDF 時,可以在儲存之前設定元資料。

該程式碼使用 RenderHtmlAsPdfUA() 將 HTML 直接渲染為 PDF/UA 格式,接著在呼叫 SaveAs() 之前,對生成的 PdfDocument 物件設定完整的元資料屬性。 這種方法將輔助功能結構和元資料嵌入到單一工作流程中,非常適合產生新的合規文件。

:path=/static-assets/pdf/content-code-examples/tutorials/accessible-pdfs-government-compliance/new-document-metadata.cs
using IronPdf;
using System;

ChromePdfRenderer renderer = new ChromePdfRenderer();

string html = @"
<!DOCTYPE html>
<html lang='en'>
<head><title>Policy Document</title></head>
<body>
    <h1>Information Security Policy</h1>
    <p>This document outlines security requirements for all employees.</p>
</body>
</html>";

PdfDocument pdf = renderer.RenderHtmlAsPdfUA(html);

// Configure comprehensive metadata
pdf.MetaData.Title = "Information Security Policy";
pdf.MetaData.Author = "IT Security Team";
pdf.MetaData.Subject = "Corporate security requirements and guidelines";
pdf.MetaData.Keywords = "security, policy, compliance, data protection";
pdf.MetaData.Creator = "Policy Management System";
pdf.MetaData.CreationDate = DateTime.Now;
pdf.MetaData.ModifiedDate = DateTime.Now;

pdf.SaveAs("security-policy-accessible.pdf");
Imports IronPdf
Imports System

Dim renderer As New ChromePdfRenderer()

Dim html As String = "
<!DOCTYPE html>
<html lang='en'>
<head><title>Policy Document</title></head>
<body>
    <h1>Information Security Policy</h1>
    <p>This document outlines security requirements for all employees.</p>
</body>
</html>"

Dim pdf As PdfDocument = renderer.RenderHtmlAsPdfUA(html)

' Configure comprehensive metadata
pdf.MetaData.Title = "Information Security Policy"
pdf.MetaData.Author = "IT Security Team"
pdf.MetaData.Subject = "Corporate security requirements and guidelines"
pdf.MetaData.Keywords = "security, policy, compliance, data protection"
pdf.MetaData.Creator = "Policy Management System"
pdf.MetaData.CreationDate = DateTime.Now
pdf.MetaData.ModifiedDate = DateTime.Now

pdf.SaveAs("security-policy-accessible.pdf")
$vbLabelText   $csharpLabel

如何為螢幕閱讀器指定文檔語言?

語言規範是一項基本的無障礙要求,它直接影響內容的語音表達方式。 當輔助科技遇到文字時,它會使用指定的語言來選擇合適的發音規則、語音和朗讀模式。 缺少語言規範的文檔會迫使軟體進行猜測,這通常會導致音訊輸出混亂或難以理解。

為了符合 PDF/UA 標準,文件必須聲明其主要語言。 IronPDF 透過 HTML 原始碼中的 lang 屬性來處理此功能,該屬性會在 PDF/UA 輸出中予以保留。

該程式碼演示了兩種語言使用場景。 前者將英文 HTML 內容渲染為 html 元素中的 lang='en',後者則將西班牙文內容處理為 lang='es'RenderHtmlAsPdfUA() 方法會保留 HTML 中的語言屬性,而 SaveAsPdfUA() 則會在輸出中維持該屬性。 這可確保螢幕閱讀器能針對文件的主要語言套用正確的發音規則。

:path=/static-assets/pdf/content-code-examples/tutorials/accessible-pdfs-government-compliance/set-language.cs
using IronPdf;

ChromePdfRenderer renderer = new ChromePdfRenderer();

string htmlContent = @"
<!DOCTYPE html>
<html lang='en'>
<head><title>Annual Report</title></head>
<body>
    <h1>Annual Report 2024</h1>
    <p>This report summarizes organizational activities and financial performance.</p>
</body>
</html>";

PdfDocument pdf = renderer.RenderHtmlAsPdfUA(htmlContent);

// Language is set via lang='en' in the HTML; SaveAsPdfUA preserves it
pdf.SaveAsPdfUA("annual-report.pdf");

string htmlContentEs = @"
<!DOCTYPE html>
<html lang='es'>
<head><title>Informe Anual</title></head>
<body>
    <h1>Informe Anual 2024</h1>
    <p>Este informe resume las actividades organizacionales y el desempeño financiero.</p>
</body>
</html>";

PdfDocument pdfEs = renderer.RenderHtmlAsPdfUA(htmlContentEs);

// Language is set via lang='es' in the HTML; SaveAsPdfUA preserves it
pdfEs.SaveAsPdfUA("informe-anual.pdf");
Imports IronPdf

Dim renderer As New ChromePdfRenderer()

Dim htmlContent As String = "
<!DOCTYPE html>
<html lang='en'>
<head><title>Annual Report</title></head>
<body>
    <h1>Annual Report 2024</h1>
    <p>This report summarizes organizational activities and financial performance.</p>
</body>
</html>"

Dim pdf As PdfDocument = renderer.RenderHtmlAsPdfUA(htmlContent)

' Language is set via lang='en' in the HTML; SaveAsPdfUA preserves it
pdf.SaveAsPdfUA("annual-report.pdf")

Dim htmlContentEs As String = "
<!DOCTYPE html>
<html lang='es'>
<head><title>Informe Anual</title></head>
<body>
    <h1>Informe Anual 2024</h1>
    <p>Este informe resume las actividades organizacionales y el desempeño financiero.</p>
</body>
</html>"

Dim pdfEs As PdfDocument = renderer.RenderHtmlAsPdfUA(htmlContentEs)

' Language is set via lang='es' in the HTML; SaveAsPdfUA preserves it
pdfEs.SaveAsPdfUA("informe-anual.pdf")
$vbLabelText   $csharpLabel

IronPDF 支援透過標準 HTML lang 屬性指定語言。 常見語言代碼包括 fr (法語)、de (德語)、pt (葡萄牙語)、zh (中文)、ja (日文)、ko (韓文) 以及 ar (阿拉伯文) 等眾多語言版本。

對於包含多種語言的文檔,主要文檔語言應反映主要內容。 輔助技術可以較好地處理偶爾出現的外語短語,但對於包含多種語言的大量內容的文檔,則會帶來更複雜的挑戰,可能需要專門的方法。

如何從HTML建立可存取的標籤的PDF結構?

帶標籤的PDF結構是可訪問性的基礎。 標籤定義了內容的邏輯組織,區分標題和段落,識別清單和清單項,標記表格,並確定閱讀順序。 如果沒有正確的標籤,輔助技術就無法向使用者傳達文件結構。

使用 IronPDF 建立具有良好標籤的 PDF 的最有效方法是從語義化的 HTML 開始。 Chromium渲染引擎在轉換為PDF時會保留HTML結構,將HTML元素轉換為對應的PDF標籤。 編寫良好的HTML程式碼會自動產生結構良好的PDF檔案。

請看下面的範例,它演示了正確的語義標記。

程式碼會建立一個具有清晰標題層級的 HTML 文件(主標題使用 h1,章節使用 h2,子章節使用 h3),並使用無序清單 (li) 用於項目符號,並使用有序清單 (li) 呈現編號序列。 RenderHtmlAsPdfUA() 方法會將這些語義元素轉換為對應的 PDF 標籤,以便輔助技術進行導航。

:path=/static-assets/pdf/content-code-examples/tutorials/accessible-pdfs-government-compliance/semantic-structure.cs
using IronPdf;
using System;

ChromePdfRenderer renderer = new ChromePdfRenderer();

string htmlContent = @"
<!DOCTYPE html>
<html lang='en'>
<head>
    <title>Project Proposal</title>
    <style>
        body { font-family: Georgia, serif; line-height: 1.8; max-width: 800px; margin: 0 auto; padding: 20px; }
        h1 { font-size: 28px; border-bottom: 2px solid #333; padding-bottom: 10px; }
        h2 { font-size: 22px; color: #444; margin-top: 30px; }
        h3 { font-size: 18px; color: #666; }
        ul, ol { margin-left: 20px; }
        li { margin-bottom: 8px; }
    </style>
</head>
<body>
    <h1>Website Redesign Proposal</h1>

    <h2>Executive Summary</h2>
    <p>This proposal outlines a comprehensive redesign of the corporate website to improve user experience, accessibility, and conversion rates.</p>

    <h2>Project Objectives</h2>
    <p>The redesign aims to achieve several key goals:</p>
    <ul>
        <li>Improve mobile responsiveness across all device types</li>
        <li>Achieve WCAG 2.1 Level AA compliance for accessibility</li>
        <li>Reduce page load times by 40 percent</li>
        <li>Increase conversion rates through improved user flows</li>
    </ul>

    <h2>Implementation Timeline</h2>
    <p>The project will proceed in three phases:</p>
    <ol>
        <li>Discovery and planning: weeks one through four</li>
        <li>Design and development: weeks five through twelve</li>
        <li>Testing and launch: weeks thirteen through sixteen</li>
    </ol>

    <h3>Phase One Details</h3>
    <p>The discovery phase includes stakeholder interviews, competitive analysis, and technical assessment of the current platform.</p>

    <h3>Phase Two Details</h3>
    <p>Design and development will follow an agile methodology with two-week sprints and regular stakeholder reviews.</p>

    <h2>Budget Considerations</h2>
    <p>The proposed budget covers all aspects of the redesign including design, development, content migration, and quality assurance testing.</p>
</body>
</html>";

PdfDocument pdf = renderer.RenderHtmlAsPdfUA(htmlContent);

pdf.MetaData.Title = "Website Redesign Proposal";
pdf.MetaData.Author = "Digital Strategy Team";

pdf.SaveAs("proposal-accessible.pdf");

Console.WriteLine("Structured document created with proper heading hierarchy.");
Imports IronPdf
Imports System

Dim renderer As New ChromePdfRenderer()

Dim htmlContent As String = "
<!DOCTYPE html>
<html lang='en'>
<head>
    <title>Project Proposal</title>
    <style>
        body { font-family: Georgia, serif; line-height: 1.8; max-width: 800px; margin: 0 auto; padding: 20px; }
        h1 { font-size: 28px; border-bottom: 2px solid #333; padding-bottom: 10px; }
        h2 { font-size: 22px; color: #444; margin-top: 30px; }
        h3 { font-size: 18px; color: #666; }
        ul, ol { margin-left: 20px; }
        li { margin-bottom: 8px; }
    </style>
</head>
<body>
    <h1>Website Redesign Proposal</h1>

    <h2>Executive Summary</h2>
    <p>This proposal outlines a comprehensive redesign of the corporate website to improve user experience, accessibility, and conversion rates.</p>

    <h2>Project Objectives</h2>
    <p>The redesign aims to achieve several key goals:</p>
    <ul>
        <li>Improve mobile responsiveness across all device types</li>
        <li>Achieve WCAG 2.1 Level AA compliance for accessibility</li>
        <li>Reduce page load times by 40 percent</li>
        <li>Increase conversion rates through improved user flows</li>
    </ul>

    <h2>Implementation Timeline</h2>
    <p>The project will proceed in three phases:</p>
    <ol>
        <li>Discovery and planning: weeks one through four</li>
        <li>Design and development: weeks five through twelve</li>
        <li>Testing and launch: weeks thirteen through sixteen</li>
    </ol>

    <h3>Phase One Details</h3>
    <p>The discovery phase includes stakeholder interviews, competitive analysis, and technical assessment of the current platform.</p>

    <h3>Phase Two Details</h3>
    <p>Design and development will follow an agile methodology with two-week sprints and regular stakeholder reviews.</p>

    <h2>Budget Considerations</h2>
    <p>The proposed budget covers all aspects of the redesign including design, development, content migration, and quality assurance testing.</p>
</body>
</html>"

Dim pdf As PdfDocument = renderer.RenderHtmlAsPdfUA(htmlContent)

pdf.MetaData.Title = "Website Redesign Proposal"
pdf.MetaData.Author = "Digital Strategy Team"

pdf.SaveAs("proposal-accessible.pdf")

Console.WriteLine("Structured document created with proper heading hierarchy.")
$vbLabelText   $csharpLabel

輸出 PDF

此PDF檔案保留了用於導航的標題層級和清單結構:

請注意本例中的標題層級結構。 該文件只有一個 h1 標題,其後是 h2 元素(主要章節),以及 h3 元素(子章節)。 這種層級結構對於無障礙存取至關重要。 輔助技術使用者通常會透過在標題之間跳轉來瀏覽文檔,因此邏輯結構能夠讓他們快速找到所需的內容。

列表採用語意處理,其中 ul 表示無序列表,ol 表示有序列表。 PDF 中的每個 li 元素都會變成一個標籤的列表項目。 輔助技術透過顯示清單包含的項目數量,然後依序朗讀每個項目來播報清單。

如何為圖片添加替代文字以使其與螢幕閱讀器相容?

圖片在可訪問性方面存在根本性的挑戰。 視覺內容無法被盲人或低視力使用者感知。 替代文字(通常稱為 alt 文字)提供可以取代圖像顯示的文字描述。

從 HTML 產生 PDF 時,img 元素的 alt 屬性會作為替代文字傳遞到 PDF 中。

此程式碼產生一份包含兩張圖表的銷售報告。 每個 img 元素皆包含一個詳細的 alt 屬性,該屬性描述的是圖表的數據內容,而非僅僅是其類型。 例如,替代文字會具體說明實際銷售數據和區域比較。 RenderHtmlAsPdfUA() 方法會將這些描述嵌入 PDF 中作為替代文字,讓螢幕閱讀器能傳達與視力正常使用者瀏覽圖表時所獲得的相同資訊。

:path=/static-assets/pdf/content-code-examples/tutorials/accessible-pdfs-government-compliance/image-accessibility.cs
using IronPdf;
using System;

ChromePdfRenderer renderer = new ChromePdfRenderer();

string htmlContent = @"
<!DOCTYPE html>
<html lang='en'>
<head>
    <title>Sales Performance Report</title>
    <style>
        body { font-family: Arial, sans-serif; padding: 20px; }
        .chart-container { margin: 20px 0; text-align: center; }
        img { max-width: 100%; height: auto; }
        .caption { font-style: italic; color: #666; margin-top: 10px; }
    </style>
</head>
<body>
    <h1>Q3 Sales Performance Report</h1>

    <h2>Regional Sales Comparison</h2>
    <p>The following chart illustrates sales performance across regions for the third quarter.</p>

    <div class='chart-container'>
        <img src='https://example.com/charts/regional-sales-q3.png'
             alt='Bar chart comparing Q3 sales across four regions: Northeast at 2.4 million dollars, Southeast at 1.8 million dollars, Midwest at 2.1 million dollars, and West at 3.2 million dollars. The West region shows the highest performance with a 15 percent increase from Q2.'
             width='600' height='400'>
        <p class='caption'>Figure 1: Regional Sales Comparison Q3 2024</p>
    </div>

    <h2>Monthly Trend Analysis</h2>
    <p>Sales showed consistent growth throughout the quarter with acceleration in September.</p>

    <div class='chart-container'>
        <img src='https://example.com/charts/monthly-trend.png'
             alt='Line graph showing monthly sales from July through September. July sales were 2.1 million dollars, August increased to 2.4 million dollars, and September reached 2.9 million dollars, representing a 38 percent total increase over the quarter.'
             width='600' height='300'>
        <p class='caption'>Figure 2: Monthly Sales Trend Q3 2024</p>
    </div>

    <h2>Key Findings</h2>
    <p>Analysis indicates strong momentum heading into Q4, particularly in the Western region where new product launches drove significant customer acquisition.</p>
</body>
</html>";

PdfDocument pdf = renderer.RenderHtmlAsPdfUA(htmlContent);

pdf.MetaData.Title = "Q3 Sales Performance Report";
pdf.MetaData.Author = "Sales Analytics Team";

pdf.SaveAs("sales-report-accessible.pdf");

Console.WriteLine("Report created with accessible image descriptions.");
Imports IronPdf
Imports System

Dim renderer As New ChromePdfRenderer()

Dim htmlContent As String = "
<!DOCTYPE html>
<html lang='en'>
<head>
    <title>Sales Performance Report</title>
    <style>
        body { font-family: Arial, sans-serif; padding: 20px; }
        .chart-container { margin: 20px 0; text-align: center; }
        img { max-width: 100%; height: auto; }
        .caption { font-style: italic; color: #666; margin-top: 10px; }
    </style>
</head>
<body>
    <h1>Q3 Sales Performance Report</h1>

    <h2>Regional Sales Comparison</h2>
    <p>The following chart illustrates sales performance across regions for the third quarter.</p>

    <div class='chart-container'>
        <img src='https://example.com/charts/regional-sales-q3.png'
             alt='Bar chart comparing Q3 sales across four regions: Northeast at 2.4 million dollars, Southeast at 1.8 million dollars, Midwest at 2.1 million dollars, and West at 3.2 million dollars. The West region shows the highest performance with a 15 percent increase from Q2.'
             width='600' height='400'>
        <p class='caption'>Figure 1: Regional Sales Comparison Q3 2024</p>
    </div>

    <h2>Monthly Trend Analysis</h2>
    <p>Sales showed consistent growth throughout the quarter with acceleration in September.</p>

    <div class='chart-container'>
        <img src='https://example.com/charts/monthly-trend.png'
             alt='Line graph showing monthly sales from July through September. July sales were 2.1 million dollars, August increased to 2.4 million dollars, and September reached 2.9 million dollars, representing a 38 percent total increase over the quarter.'
             width='600' height='300'>
        <p class='caption'>Figure 2: Monthly Sales Trend Q3 2024</p>
    </div>

    <h2>Key Findings</h2>
    <p>Analysis indicates strong momentum heading into Q4, particularly in the Western region where new product launches drove significant customer acquisition.</p>
</body>
</html>"

Dim pdf As PdfDocument = renderer.RenderHtmlAsPdfUA(htmlContent)

pdf.MetaData.Title = "Q3 Sales Performance Report"
pdf.MetaData.Author = "Sales Analytics Team"

pdf.SaveAs("sales-report-accessible.pdf")

Console.WriteLine("Report created with accessible image descriptions.")
$vbLabelText   $csharpLabel

撰寫有效的替代文字需要了解圖像所傳達的訊息。 對於圖表,替代文字應該描述所呈現的數據,而不僅僅是說明存在圖表。 僅僅說"柱狀圖"並不能提供任何有用的信息。 描述"第三季四個地區的銷售額對比長條圖,其中西部地區以 320 萬美元領先"可以讓視力障礙用戶獲得與視力正常用戶查看圖表時相同的洞察力。

不具備任何資訊功能的裝飾性圖片,其 alt 屬性應為空。 這會向螢幕閱讀器發出信號,表明可以跳過該圖像:

<img src="decorative-border.png" alt="">
<img src="decorative-border.png" alt="">
HTML

如何在PDF文件中建立無障礙表格?

表格由於以二維方式編碼資料之間的關係,因此在可訪問性方面存在複雜的問題。 視力正常的使用者可以透過視覺掃描行和列來了解單元格與其標題之間的關係。 使用輔助技術的使用者需要透過正確的標記明確定義這種關係。

HTML 提供了實現無障礙表格所需的結構元素。 關鍵元素包括用於標題單元格的 th、用於資料單元格的 td,以及用於明確標題是套用於行還是列的範圍屬性。

此程式碼建立了一個附有正確無障礙標記的員工名錄表格。caption 元素提供了一個表格標題,該標題會在內容播放前被宣讀。 標題儲存格使用 th 搭配 scope="col" 來表示其設定適用於該欄位中的所有儲存格。 theadtbody 元素用於區隔結構性段落。 IronPDF 的 RenderHtmlAsPdfUA() 功能能保留 PDF 結構中的這些關聯性,讓螢幕閱讀器得以將資料儲存格與其欄位標題相互對應。

:path=/static-assets/pdf/content-code-examples/tutorials/accessible-pdfs-government-compliance/accessible-table.cs
using IronPdf;
using System;

ChromePdfRenderer renderer = new ChromePdfRenderer();

string htmlContent = @"
<!DOCTYPE html>
<html lang='en'>
<head>
    <title>Employee Directory</title>
    <style>
        body { font-family: Arial, sans-serif; padding: 20px; }
        table { border-collapse: collapse; width: 100%; margin: 20px 0; }
        th, td { border: 1px solid #ccc; padding: 12px; text-align: left; }
        th { background-color: #f0f0f0; font-weight: bold; }
        caption { font-size: 18px; font-weight: bold; margin-bottom: 10px; text-align: left; }
    </style>
</head>
<body>
    <h1>Department Staff Directory</h1>
    <p>Contact information for all department personnel as of January 2024.</p>

    <table>
        <caption>Engineering Department Staff</caption>
        <thead>
            <tr>
                <th scope='col'>Name</th>
                <th scope='col'>Title</th>
                <th scope='col'>Email</th>
                <th scope='col'>Extension</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>Sarah Chen</td>
                <td>Senior Software Engineer</td>
                <td>schen@company.com</td>
                <td>4521</td>
            </tr>
            <tr>
                <td>Marcus Williams</td>
                <td>DevOps Engineer</td>
                <td>mwilliams@company.com</td>
                <td>4522</td>
            </tr>
            <tr>
                <td>Jennifer Park</td>
                <td>QA Lead</td>
                <td>jpark@company.com</td>
                <td>4523</td>
            </tr>
            <tr>
                <td>Robert Gonzalez</td>
                <td>Technical Writer</td>
                <td>rgonzalez@company.com</td>
                <td>4524</td>
            </tr>
        </tbody>
    </table>

    <h2>Contact Guidelines</h2>
    <p>Please use email for non-urgent matters. Phone extensions connect to voicemail outside business hours.</p>
</body>
</html>";

PdfDocument pdf = renderer.RenderHtmlAsPdfUA(htmlContent);

pdf.MetaData.Title = "Department Staff Directory";

pdf.SaveAs("directory-accessible.pdf");

Console.WriteLine("Directory created with accessible table structure.");
Imports IronPdf
Imports System

Dim renderer As New ChromePdfRenderer()

Dim htmlContent As String = "
<!DOCTYPE html>
<html lang='en'>
<head>
    <title>Employee Directory</title>
    <style>
        body { font-family: Arial, sans-serif; padding: 20px; }
        table { border-collapse: collapse; width: 100%; margin: 20px 0; }
        th, td { border: 1px solid #ccc; padding: 12px; text-align: left; }
        th { background-color: #f0f0f0; font-weight: bold; }
        caption { font-size: 18px; font-weight: bold; margin-bottom: 10px; text-align: left; }
    </style>
</head>
<body>
    <h1>Department Staff Directory</h1>
    <p>Contact information for all department personnel as of January 2024.</p>

    <table>
        <caption>Engineering Department Staff</caption>
        <thead>
            <tr>
                <th scope='col'>Name</th>
                <th scope='col'>Title</th>
                <th scope='col'>Email</th>
                <th scope='col'>Extension</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>Sarah Chen</td>
                <td>Senior Software Engineer</td>
                <td>schen@company.com</td>
                <td>4521</td>
            </tr>
            <tr>
                <td>Marcus Williams</td>
                <td>DevOps Engineer</td>
                <td>mwilliams@company.com</td>
                <td>4522</td>
            </tr>
            <tr>
                <td>Jennifer Park</td>
                <td>QA Lead</td>
                <td>jpark@company.com</td>
                <td>4523</td>
            </tr>
            <tr>
                <td>Robert Gonzalez</td>
                <td>Technical Writer</td>
                <td>rgonzalez@company.com</td>
                <td>4524</td>
            </tr>
        </tbody>
    </table>

    <h2>Contact Guidelines</h2>
    <p>Please use email for non-urgent matters. Phone extensions connect to voicemail outside business hours.</p>
</body>
</html>"

Dim pdf As PdfDocument = renderer.RenderHtmlAsPdfUA(htmlContent)

pdf.MetaData.Title = "Department Staff Directory"

pdf.SaveAs("directory-accessible.pdf")

Console.WriteLine("Directory created with accessible table structure.")
$vbLabelText   $csharpLabel

輸出 PDF

輸出結果包含一個結構正確的表格,表格中包含表頭關聯資訊:

th 元素的 scope 屬性至關重要。 設定 scope="col" 表示標題套用於該列中的所有儲存格。 對於每行第一個儲存格用作行標題的表格,您應該使用 scope="row" 來代替。 包含行標題和列標題的複雜表格需要同時具有這兩個屬性。

caption 元素為表格提供標題,該標題會在閱讀表格內容之前顯示。 這能讓用戶了解他們即將聽到的數據的背景資訊。

對於合併儲存格或結構不規則的表格,可以使用標題和 ID 等附加屬性將資料儲存格與其對應的標題明確連接。 但是,從可訪問性的角度來看,具有一致行和列的簡單表格結構是更可取的。

如何為文件添加書籤和導航以增強其可訪問性?

書籤提供導航地標,幫助所有使用者瀏覽冗長的文檔,但對於輔助功能而言尤其有價值。 無法透過視覺瀏覽頁面的使用者依靠書籤來尋找感興趣的部分。這些結構化的概要可以讓使用者直接跳到特定內容。

IronPDF 支援以程式設計方式建立分層書籤結構

該程式碼會渲染一份包含多個章節的員工手冊,然後透過 Bookmarks 集合以程式化方式新增書籤層級結構。 頂層書籤透過 AddBookMarkAtEnd() 連結至各章節起始頁面,並附有頁碼索引。 子節目的子書籤是透過父節目的 Children 屬性新增的,藉此建立嵌套的導覽樹。 頁面索引參數從零開始,因此第 0 頁是第一頁。

:path=/static-assets/pdf/content-code-examples/tutorials/accessible-pdfs-government-compliance/bookmarks-navigation.cs
using IronPdf;
using System;

ChromePdfRenderer renderer = new ChromePdfRenderer();

string htmlContent = @"
<!DOCTYPE html>
<html lang='en'>
<head>
    <title>Employee Handbook</title>
    <style>
        body { font-family: Georgia, serif; line-height: 1.8; padding: 40px; }
        h1 { page-break-before: always; }
        h1:first-of-type { page-break-before: avoid; }
        h2 { margin-top: 30px; }
    </style>
</head>
<body>
    <h1>Employee Handbook</h1>
    <p>Welcome to our organization. This handbook contains policies and procedures for all employees.</p>

    <h1>Chapter 1: Employment Policies</h1>
    <h2>Equal Opportunity</h2>
    <p>Our organization is committed to providing equal employment opportunities to all applicants and employees.</p>

    <h2>At-Will Employment</h2>
    <p>Employment with the organization is at-will unless otherwise specified in a written agreement.</p>

    <h1>Chapter 2: Compensation and Benefits</h1>
    <h2>Pay Periods</h2>
    <p>Employees are paid on a bi-weekly basis, with pay dates falling on alternating Fridays.</p>

    <h2>Health Insurance</h2>
    <p>Full-time employees are eligible for health insurance coverage beginning the first of the month following hire date.</p>

    <h2>Retirement Plans</h2>
    <p>The organization offers a 401(k) plan with employer matching contributions up to four percent of salary.</p>

    <h1>Chapter 3: Time Off Policies</h1>
    <h2>Vacation</h2>
    <p>Employees accrue vacation time based on length of service, starting at two weeks annually.</p>

    <h2>Sick Leave</h2>
    <p>Employees receive five days of paid sick leave per calendar year.</p>
</body>
</html>";

PdfDocument pdf = renderer.RenderHtmlAsPdfUA(htmlContent);

// Add top-level bookmarks for main sections
var introBookmark = pdf.Bookmarks.AddBookMarkAtEnd("Introduction", 0);

var chapter1Bookmark = pdf.Bookmarks.AddBookMarkAtEnd("Chapter 1: Employment Policies", 1);
chapter1Bookmark.Children.AddBookMarkAtEnd("Equal Opportunity", 1);
chapter1Bookmark.Children.AddBookMarkAtEnd("At-Will Employment", 1);

var chapter2Bookmark = pdf.Bookmarks.AddBookMarkAtEnd("Chapter 2: Compensation and Benefits", 2);
chapter2Bookmark.Children.AddBookMarkAtEnd("Pay Periods", 2);
chapter2Bookmark.Children.AddBookMarkAtEnd("Health Insurance", 2);
chapter2Bookmark.Children.AddBookMarkAtEnd("Retirement Plans", 2);

var chapter3Bookmark = pdf.Bookmarks.AddBookMarkAtEnd("Chapter 3: Time Off Policies", 3);
chapter3Bookmark.Children.AddBookMarkAtEnd("Vacation", 3);
chapter3Bookmark.Children.AddBookMarkAtEnd("Sick Leave", 3);

pdf.MetaData.Title = "Employee Handbook";
pdf.MetaData.Author = "Human Resources";

pdf.SaveAs("handbook-with-bookmarks.pdf");

Console.WriteLine("Handbook created with navigational bookmarks.");
Imports IronPdf
Imports System

Dim renderer As New ChromePdfRenderer()

Dim htmlContent As String = "
<!DOCTYPE html>
<html lang='en'>
<head>
    <title>Employee Handbook</title>
    <style>
        body { font-family: Georgia, serif; line-height: 1.8; padding: 40px; }
        h1 { page-break-before: always; }
        h1:first-of-type { page-break-before: avoid; }
        h2 { margin-top: 30px; }
    </style>
</head>
<body>
    <h1>Employee Handbook</h1>
    <p>Welcome to our organization. This handbook contains policies and procedures for all employees.</p>

    <h1>Chapter 1: Employment Policies</h1>
    <h2>Equal Opportunity</h2>
    <p>Our organization is committed to providing equal employment opportunities to all applicants and employees.</p>

    <h2>At-Will Employment</h2>
    <p>Employment with the organization is at-will unless otherwise specified in a written agreement.</p>

    <h1>Chapter 2: Compensation and Benefits</h1>
    <h2>Pay Periods</h2>
    <p>Employees are paid on a bi-weekly basis, with pay dates falling on alternating Fridays.</p>

    <h2>Health Insurance</h2>
    <p>Full-time employees are eligible for health insurance coverage beginning the first of the month following hire date.</p>

    <h2>Retirement Plans</h2>
    <p>The organization offers a 401(k) plan with employer matching contributions up to four percent of salary.</p>

    <h1>Chapter 3: Time Off Policies</h1>
    <h2>Vacation</h2>
    <p>Employees accrue vacation time based on length of service, starting at two weeks annually.</p>

    <h2>Sick Leave</h2>
    <p>Employees receive five days of paid sick leave per calendar year.</p>
</body>
</html>"

Dim pdf As PdfDocument = renderer.RenderHtmlAsPdfUA(htmlContent)

' Add top-level bookmarks for main sections
Dim introBookmark = pdf.Bookmarks.AddBookMarkAtEnd("Introduction", 0)

Dim chapter1Bookmark = pdf.Bookmarks.AddBookMarkAtEnd("Chapter 1: Employment Policies", 1)
chapter1Bookmark.Children.AddBookMarkAtEnd("Equal Opportunity", 1)
chapter1Bookmark.Children.AddBookMarkAtEnd("At-Will Employment", 1)

Dim chapter2Bookmark = pdf.Bookmarks.AddBookMarkAtEnd("Chapter 2: Compensation and Benefits", 2)
chapter2Bookmark.Children.AddBookMarkAtEnd("Pay Periods", 2)
chapter2Bookmark.Children.AddBookMarkAtEnd("Health Insurance", 2)
chapter2Bookmark.Children.AddBookMarkAtEnd("Retirement Plans", 2)

Dim chapter3Bookmark = pdf.Bookmarks.AddBookMarkAtEnd("Chapter 3: Time Off Policies", 3)
chapter3Bookmark.Children.AddBookMarkAtEnd("Vacation", 3)
chapter3Bookmark.Children.AddBookMarkAtEnd("Sick Leave", 3)

pdf.MetaData.Title = "Employee Handbook"
pdf.MetaData.Author = "Human Resources"

pdf.SaveAs("handbook-with-bookmarks.pdf")

Console.WriteLine("Handbook created with navigational bookmarks.")
$vbLabelText   $csharpLabel

輸出 PDF

產生的 PDF 檔案包含一個可導航的書籤面板,方便快速存取各個章節:

AddBookMarkAtEnd 中的頁面索引參數使用從零開始的索引,其中第 0 頁是文件的第一頁。 透過 Children 屬性建立的巢狀書籤會建立一個與文件結構相對應的層次結構。

對於具有正確標題結構的 HTML 文檔,IronPDF 可以自動產生包含連結導覽的目錄

透過將 RenderingOptions.TableOfContents 設定為 TableOfContentsTypes.WithPageNumbers,即可啟用自動生成目錄的功能。 HTML 內容包含佔位符 divid="ironpdf-toc",生成的目錄將插入於此處。 IronPDF 會掃描標題元素(h2 等),建立包含頁碼的階層式目錄,並將其插入至預留位置。

:path=/static-assets/pdf/content-code-examples/tutorials/accessible-pdfs-government-compliance/table-of-contents.cs
using IronPdf;

ChromePdfRenderer renderer = new ChromePdfRenderer();

// Enable automatic table of contents generation
renderer.RenderingOptions.TableOfContents = TableOfContentsTypes.WithPageNumbers;

string htmlContent = @"
<!DOCTYPE html>
<html lang='en'>
<head><title>Technical Manual</title></head>
<body>
    <div id='ironpdf-toc'></div>

    <h1>System Administration Guide</h1>
    <p>Comprehensive guide to system configuration and maintenance.</p>

    <h2>Installation</h2>
    <p>Step-by-step installation procedures for all supported platforms.</p>

    <h2>Configuration</h2>
    <p>Detailed configuration options and recommended settings.</p>

    <h2>Troubleshooting</h2>
    <p>Common issues and their resolutions.</p>
</body>
</html>";

PdfDocument pdf = renderer.RenderHtmlAsPdfUA(htmlContent);

pdf.MetaData.Title = "System Administration Guide";

pdf.SaveAs("manual-with-toc.pdf");
Imports IronPdf

Dim renderer As New ChromePdfRenderer()

' Enable automatic table of contents generation
renderer.RenderingOptions.TableOfContents = TableOfContentsTypes.WithPageNumbers

Dim htmlContent As String = "
<!DOCTYPE html>
<html lang='en'>
<head><title>Technical Manual</title></head>
<body>
    <div id='ironpdf-toc'></div>

    <h1>System Administration Guide</h1>
    <p>Comprehensive guide to system configuration and maintenance.</p>

    <h2>Installation</h2>
    <p>Step-by-step installation procedures for all supported platforms.</p>

    <h2>Configuration</h2>
    <p>Detailed configuration options and recommended settings.</p>

    <h2>Troubleshooting</h2>
    <p>Common issues and their resolutions.</p>
</body>
</html>"

Dim pdf As PdfDocument = renderer.RenderHtmlAsPdfUA(htmlContent)

pdf.MetaData.Title = "System Administration Guide"

pdf.SaveAs("manual-with-toc.pdf")
$vbLabelText   $csharpLabel

id="ironpdf-toc" 的 div 元素標示了產生的目錄將顯示的位置。 IronPDF 透過標題元素建立目錄,建立可點擊的連結跳到各個部分。

如何建立帶有正確標籤的無障礙PDF表單?

互動式表單需要特別注意其可訪問性。 每個輸入欄位都必須有一個程式關聯的標籤,以便能夠播報預期的輸入內容。 單靠視覺標籤是不夠的,因為它們缺乏輔助技術正確解讀表單所需的底層連結。

IronPDF 將 HTML 表單元素渲染為互動式 PDF 表單欄位。 正確的HTML表單標記可以轉換為易於存取的PDF表單。

該程式碼可透過設定 RenderingOptions.CreatePdfFormsFromHtml = true 來建立表單欄位。 該 HTML 表單採用了正確的無障礙設計模式:每個輸入欄位皆配有唯一的 id,該標籤與其標籤元素的 for 屬性相對應;單選鈕分組於 fieldset 內並附有描述性 legend;而核取方塊則配有對應的標籤。 RenderHtmlAsPdfUA() 方法會將這些元素轉換為互動式 PDF 表單欄位,並保留標籤關聯性以供螢幕閱讀器使用。

:path=/static-assets/pdf/content-code-examples/tutorials/accessible-pdfs-government-compliance/accessible-form.cs
using IronPdf;
using System;

ChromePdfRenderer renderer = new ChromePdfRenderer();

// Enable form field creation from HTML forms
renderer.RenderingOptions.CreatePdfFormsFromHtml = true;

string htmlContent = @"
<!DOCTYPE html>
<html lang='en'>
<head>
    <title>Contact Request Form</title>
    <style>
        body { font-family: Arial, sans-serif; padding: 30px; max-width: 600px; }
        .form-group { margin-bottom: 20px; }
        label { display: block; margin-bottom: 5px; font-weight: bold; }
        input[type='text'], input[type='email'], textarea {
            width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px;
        }
        textarea { height: 120px; resize: vertical; }
        .checkbox-group { margin: 15px 0; }
        .checkbox-group label { display: inline; font-weight: normal; margin-left: 8px; }
        fieldset { border: 1px solid #ddd; padding: 15px; margin-bottom: 20px; }
        legend { font-weight: bold; padding: 0 10px; }
    </style>
</head>
<body>
    <h1>Contact Request Form</h1>
    <p>Please complete all required fields marked with an asterisk.</p>

    <form>
        <div class='form-group'>
            <label for='fullname'>Full Name *</label>
            <input type='text' id='fullname' name='fullname' required>
        </div>

        <div class='form-group'>
            <label for='email'>Email Address *</label>
            <input type='email' id='email' name='email' required>
        </div>

        <div class='form-group'>
            <label for='phone'>Phone Number</label>
            <input type='text' id='phone' name='phone'>
        </div>

        <fieldset>
            <legend>Preferred Contact Method</legend>
            <div class='checkbox-group'>
                <input type='radio' id='contact-email' name='contact-method' value='email'>
                <label for='contact-email'>Email</label>
            </div>
            <div class='checkbox-group'>
                <input type='radio' id='contact-phone' name='contact-method' value='phone'>
                <label for='contact-phone'>Phone</label>
            </div>
        </fieldset>

        <div class='form-group'>
            <label for='message'>Message *</label>
            <textarea id='message' name='message' required></textarea>
        </div>

        <div class='checkbox-group'>
            <input type='checkbox' id='newsletter' name='newsletter'>
            <label for='newsletter'>Subscribe to our newsletter</label>
        </div>
    </form>
</body>
</html>";

PdfDocument pdf = renderer.RenderHtmlAsPdfUA(htmlContent);

pdf.MetaData.Title = "Contact Request Form";

pdf.SaveAs("contact-form-accessible.pdf");

Console.WriteLine("Accessible form created with proper field labels.");
Imports IronPdf
Imports System

Dim renderer As New ChromePdfRenderer()

' Enable form field creation from HTML forms
renderer.RenderingOptions.CreatePdfFormsFromHtml = True

Dim htmlContent As String = "
<!DOCTYPE html>
<html lang='en'>
<head>
    <title>Contact Request Form</title>
    <style>
        body { font-family: Arial, sans-serif; padding: 30px; max-width: 600px; }
        .form-group { margin-bottom: 20px; }
        label { display: block; margin-bottom: 5px; font-weight: bold; }
        input[type='text'], input[type='email'], textarea {
            width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px;
        }
        textarea { height: 120px; resize: vertical; }
        .checkbox-group { margin: 15px 0; }
        .checkbox-group label { display: inline; font-weight: normal; margin-left: 8px; }
        fieldset { border: 1px solid #ddd; padding: 15px; margin-bottom: 20px; }
        legend { font-weight: bold; padding: 0 10px; }
    </style>
</head>
<body>
    <h1>Contact Request Form</h1>
    <p>Please complete all required fields marked with an asterisk.</p>

    <form>
        <div class='form-group'>
            <label for='fullname'>Full Name *</label>
            <input type='text' id='fullname' name='fullname' required>
        </div>

        <div class='form-group'>
            <label for='email'>Email Address *</label>
            <input type='email' id='email' name='email' required>
        </div>

        <div class='form-group'>
            <label for='phone'>Phone Number</label>
            <input type='text' id='phone' name='phone'>
        </div>

        <fieldset>
            <legend>Preferred Contact Method</legend>
            <div class='checkbox-group'>
                <input type='radio' id='contact-email' name='contact-method' value='email'>
                <label for='contact-email'>Email</label>
            </div>
            <div class='checkbox-group'>
                <input type='radio' id='contact-phone' name='contact-method' value='phone'>
                <label for='contact-phone'>Phone</label>
            </div>
        </fieldset>

        <div class='form-group'>
            <label for='message'>Message *</label>
            <textarea id='message' name='message' required></textarea>
        </div>

        <div class='checkbox-group'>
            <input type='checkbox' id='newsletter' name='newsletter'>
            <label for='newsletter'>Subscribe to our newsletter</label>
        </div>
    </form>
</body>
</html>"

Dim pdf As PdfDocument = renderer.RenderHtmlAsPdfUA(htmlContent)

pdf.MetaData.Title = "Contact Request Form"

pdf.SaveAs("contact-form-accessible.pdf")

Console.WriteLine("Accessible form created with proper field labels.")
$vbLabelText   $csharpLabel

輸出 PDF

產生的 PDF 檔案包含帶有正確標籤關聯的互動式表單欄位:

此表單範例中出現了幾種輔助使用模式。 每個輸入框都有一個唯一的 id 屬性,該屬性與其標籤的 for 屬性相符。 透過此連接,當使用者使用 Tab 鍵切換到"姓名,編輯文字"欄位時,可以播報該欄位內容。 單選按鈕被分組到一個欄位集中,該欄位集帶有圖例,用於描述該組的用途。 複選框的標籤位於輸入元素之後,遵循標準表單約定。

若要使 IronPDF 建立互動式表單欄位而不是表單的靜態表示,必須啟用 CreatePdfFormsFromHtml渲染選項

產生後如何驗證 PDF/UA 合規性?

建立具有輔助功能功能的 PDF 檔案只是整個過程的一部分。 驗證確認產生的文件確實符合 PDF/UA 標準的技術要求。 目前有多種工具可用於此目的,其中 veraPDF 是最廣為人知的開源驗證器。

雖然 IronPDF 沒有內建驗證功能,但您可以使用外部工具將驗證功能整合到您的工作流程中。 veraPDF 驗證器是一個命令列應用程序,可以從 C# 程式碼中呼叫。

此程式碼展示了一個完整的驗證工作流程。 首先,它會使用 RenderHtmlAsPdfUA() 並配置元資料來生成一個測試 PDF。 接著,它透過 Process.Start() 從 C# 呼叫 veraPDF,並設定執行程序時使用 --flavour ua1 旗標進行 PDF/UA-1 驗證。 系統會擷取輸出結果,並根據退出代碼判定文件是否通過驗證。

:path=/static-assets/pdf/content-code-examples/tutorials/accessible-pdfs-government-compliance/validation.cs
using IronPdf;
using System;
using System.Diagnostics;

// Create the accessible PDF
ChromePdfRenderer renderer = new ChromePdfRenderer();

string htmlContent = @"
<!DOCTYPE html>
<html lang='en'>
<head><title>Test Document</title></head>
<body>
    <h1>Validation Test</h1>
    <p>This document will be validated for PDF/UA compliance.</p>
</body>
</html>";

PdfDocument pdf = renderer.RenderHtmlAsPdfUA(htmlContent);
pdf.MetaData.Title = "Validation Test Document";

string outputPath = "test-document.pdf";
pdf.SaveAs(outputPath);

Console.WriteLine($"PDF created at: {outputPath}");
Console.WriteLine("Run veraPDF validation with:");
Console.WriteLine($"  verapdf --flavour ua1 {outputPath}");

// Validate using veraPDF
string verapdfPath = "verapdf";
ProcessStartInfo startInfo = new ProcessStartInfo
{
    FileName = verapdfPath,
    Arguments = $"--flavour ua1 \"{outputPath}\"",
    RedirectStandardOutput = true,
    RedirectStandardError = true,
    UseShellExecute = false,
    CreateNoWindow = true
};

using (Process process = Process.Start(startInfo))
{
    string output = process.StandardOutput.ReadToEnd();
    process.WaitForExit();

    // veraPDF returns 0 for valid documents
    bool isValid = process.ExitCode == 0;

    Console.WriteLine(isValid ? "Document passes PDF/UA validation." : "Document has validation issues.");
    Console.WriteLine(output);
}
Imports IronPdf
Imports System
Imports System.Diagnostics

' Create the accessible PDF
Dim renderer As New ChromePdfRenderer()

Dim htmlContent As String = "
<!DOCTYPE html>
<html lang='en'>
<head><title>Test Document</title></head>
<body>
    <h1>Validation Test</h1>
    <p>This document will be validated for PDF/UA compliance.</p>
</body>
</html>"

Dim pdf As PdfDocument = renderer.RenderHtmlAsPdfUA(htmlContent)
pdf.MetaData.Title = "Validation Test Document"

Dim outputPath As String = "test-document.pdf"
pdf.SaveAs(outputPath)

Console.WriteLine($"PDF created at: {outputPath}")
Console.WriteLine("Run veraPDF validation with:")
Console.WriteLine($"  verapdf --flavour ua1 {outputPath}")

' Validate using veraPDF
Dim verapdfPath As String = "verapdf"
Dim startInfo As New ProcessStartInfo With {
    .FileName = verapdfPath,
    .Arguments = $"--flavour ua1 ""{outputPath}""",
    .RedirectStandardOutput = True,
    .RedirectStandardError = True,
    .UseShellExecute = False,
    .CreateNoWindow = True
}

Using process As Process = Process.Start(startInfo)
    Dim output As String = process.StandardOutput.ReadToEnd()
    process.WaitForExit()

    ' veraPDF returns 0 for valid documents
    Dim isValid As Boolean = process.ExitCode = 0

    Console.WriteLine(If(isValid, "Document passes PDF/UA validation.", "Document has validation issues."))
    Console.WriteLine(output)
End Using
$vbLabelText   $csharpLabel

Adobe Acrobat Pro 還包含輔助使用檢查功能。 Acrobat Pro 中的輔助使用檢查器可執行全面的測試,包括閱讀順序驗證、替代文字驗證和表單欄位輔助功能。 雖然 Acrobat Pro 不是免費的,但它在企業環境中很常見,並且可以提供有關輔助功能問題的詳細報告。

對於自動化測試流程,PDF/UA 基金會的 PAC(PDF 可訪問性檢查器)工具提供了另一個驗證選項。 PAC 提供圖形介面和命令列功能,使其適合整合到持續整合工作流程中。

企業應用程式中維護可存取 PDF 的最佳實務是什麼?

一旦掌握了技巧,創建可存取的個人化文件就非常簡單。 在企業範圍內大規模保持可訪問性需要係統化的方法和組織紀律。

模板標準化可以減少差異並確保一致性。 建立一個具有語意結構、易於存取的表單模式和一致樣式的已核准HTML 範本庫,可以為開發人員提供一個預設即可產生符合規範的輸出的基礎。

此程式碼展示了一種Enterprise級報表生成模式。 它會初始化一個 ChromePdfRenderer 並啟用表單建立功能,接著利用 HttpUtility.HtmlEncode() 進行安全內容插入,並根據範本變數建立 HTML 報表。 該報告的 HTML 檔案具備一致的樣式與語義結構。 使用 RenderHtmlAsPdfUA() 渲染後,將在儲存前設定標準元資料屬性(標題、作者、建立者及日期)。 此模式可封裝為可重複使用的服務,以確保所有生成的文件皆符合無障礙規範。

:path=/static-assets/pdf/content-code-examples/tutorials/accessible-pdfs-government-compliance/enterprise-service.cs
using IronPdf;
using System;
using System.Web;

ChromePdfRenderer renderer = new ChromePdfRenderer();
renderer.RenderingOptions.CreatePdfFormsFromHtml = true;

string title = "Quarterly Report";
string author = "Finance Team";
string content = "<p>Financial performance overview for Q4 2024.</p>";

// Build report HTML from template
string reportHtml = $@"
<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='UTF-8'>
    <title>{HttpUtility.HtmlEncode(title)}</title>
    <style>
        body {{
            font-family: 'Segoe UI', Arial, sans-serif;
            line-height: 1.6;
            max-width: 800px;
            margin: 0 auto;
            padding: 40px;
            color: #333;
        }}
        h1 {{ font-size: 28px; color: #1a1a1a; border-bottom: 2px solid #0066cc; padding-bottom: 10px; }}
        h2 {{ font-size: 22px; color: #333; margin-top: 30px; }}
        p {{ margin-bottom: 15px; }}
        table {{ border-collapse: collapse; width: 100%; margin: 20px 0; }}
        th, td {{ border: 1px solid #ddd; padding: 12px; text-align: left; }}
        th {{ background-color: #f5f5f5; }}
    </style>
</head>
<body>
    <h1>{HttpUtility.HtmlEncode(title)}</h1>
    {content}
</body>
</html>";

PdfDocument pdf = renderer.RenderHtmlAsPdfUA(reportHtml);

// Configure standard metadata
pdf.MetaData.Title = title;
pdf.MetaData.Author = author;
pdf.MetaData.Creator = "Enterprise Document System";
pdf.MetaData.CreationDate = DateTime.Now;
pdf.MetaData.ModifiedDate = DateTime.Now;

pdf.SaveAs("quarterly-report-accessible.pdf");
Imports IronPdf
Imports System
Imports System.Web

Dim renderer As New ChromePdfRenderer()
renderer.RenderingOptions.CreatePdfFormsFromHtml = True

Dim title As String = "Quarterly Report"
Dim author As String = "Finance Team"
Dim content As String = "<p>Financial performance overview for Q4 2024.</p>"

' Build report HTML from template
Dim reportHtml As String = $"
<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='UTF-8'>
    <title>{HttpUtility.HtmlEncode(title)}</title>
    <style>
        body {{
            font-family: 'Segoe UI', Arial, sans-serif;
            line-height: 1.6;
            max-width: 800px;
            margin: 0 auto;
            padding: 40px;
            color: #333;
        }}
        h1 {{ font-size: 28px; color: #1a1a1a; border-bottom: 2px solid #0066cc; padding-bottom: 10px; }}
        h2 {{ font-size: 22px; color: #333; margin-top: 30px; }}
        p {{ margin-bottom: 15px; }}
        table {{ border-collapse: collapse; width: 100%; margin: 20px 0; }}
        th, td {{ border: 1px solid #ddd; padding: 12px; text-align: left; }}
        th {{ background-color: #f5f5f5; }}
    </style>
</head>
<body>
    <h1>{HttpUtility.HtmlEncode(title)}</h1>
    {content}
</body>
</html>"

Dim pdf As PdfDocument = renderer.RenderHtmlAsPdfUA(reportHtml)

' Configure standard metadata
pdf.MetaData.Title = title
pdf.MetaData.Author = author
pdf.MetaData.Creator = "Enterprise Document System"
pdf.MetaData.CreationDate = DateTime.Now
pdf.MetaData.ModifiedDate = DateTime.Now

pdf.SaveAs("quarterly-report-accessible.pdf")
$vbLabelText   $csharpLabel

自動化測試應該成為持續整合流程的一部分。任何產生 PDF 檔案的流程都應該包含驗證步驟,如果未滿足無障礙存取要求,則建置應該失敗。 這樣可以防止無法存取的文件進入生產環境。

員工培訓與技術實施同等重要。 內容作者需要了解無障礙設計的重要性,以及他們的選擇如何影響最終成果。 教導作者正確使用標題等級、提供有意義的圖像描述以及建立良好的表格結構,可以產生更好的來源材料,從而轉換為符合規範的 PDF 文件。

模板的版本控制和定期的無障礙審核有助於長期保持合規性。隨著業務需求的演變和範本的修改,定期審查可以確保這些變更不會無意中引入無障礙障礙。

將您的無障礙措施記錄下來,就能形成一種機構知識,這種知識即使在人員更迭後也能保留下來。 記錄你遵循的標準、你使用的驗證工具以及針對已發現問題的補救程序,有助於在整個組織內保持一致的做法。

無障礙環境並非一蹴可幾,而是持續的承諾。 標準不斷發展,輔助技術不斷改進,使用者需求也不斷變化。 將無障礙設計融入標準工作流程,而不是將其視為事後考慮的組織,最能滿足當前的需求和未來的期望。

本指南中介紹的技術為使用 IronPDF 創建符合第 508 條款的 PDF 奠定了堅實的基礎。 透過結合正確的 HTML 結構、適當的元資料、導航輔助和驗證測試,.NET 開發人員可以產生符合法律要求的文檔,同時真正服務於依賴無障礙內容的使用者。

結論

IronPDF簡化了 PDF 可訪問性標準的複雜性,使 .NET 開發人員能夠專注於內容,而該程式庫則處理底層PDF/UA 結構要求。 本教學涵蓋了將現有 PDF 轉換為 PDF/UA 格式、將 HTML 直接渲染為可存取的 PDF 、設定文件元資料和語言規範以相容螢幕閱讀器、從語義 HTML建立帶有標籤的文件結構、建立可存取的表單和帶有書籤的導航,以及使用 veraPDF 等外部工具驗證合規性。

當可訪問性成為更廣泛的文件生命週期的一部分時,這些模式自然而然地與PDF/A 歸檔合規性相結合,以實現長期保存和批量處理,從而在政府或醫療保健系統中大規模生成可訪問文件。

準備開始建造了嗎? 下載 IronPDF並免費試用。 同一個庫可以處理從單一可存取文件產生到企業級 PDF/UA 合規性流程的所有操作。 如果您對無障礙實施或第 508 條款要求有任何疑問,請聯絡我們的工程支援團隊

常見問題解答

什麼是 PDF 檔案的 Section 508 合規性要求?

第 508 條款合規性確保電子和資訊科技(例如 PDF)對殘障人士無障礙。 IronPDF 可協助您建立符合這些標準的 PDF 文件,例如新增替代文字、建立無障礙表格等等。

如何使用 IronPDF 將現有 PDF 檔案轉換為 PDF/UA 格式?

IronPDF 提供將現有 PDF 檔案轉換為 PDF/UA 格式的功能,確保其符合無障礙標準。這包括添加必要的元資料和結構化元素,使內容更易於存取。

IronPDF能否幫助渲染無障礙HTML?

是的,IronPDF 可以渲染出符合 PDF/UA 標準的可存取 HTML 內容,更容易從 Web 內容建立可存取文件。

如何使用 IronPDF 為 PDF 中的圖像添加替代文字?

IronPDF 允許您為 PDF 中的圖像添加替代文本,這對於提高可訪問性至關重要。此功能可確保依賴螢幕閱讀器的使用者能夠理解影像內容。

IronPDF 為建立無障礙表單和表單提供了哪些功能?

IronPDF 提供建立結構化表格和表單的工具,這些表格和表單易於訪問,有助於確保所有使用者都能瀏覽和理解資料和輸入欄位。

如何使用 IronPDF 驗證我的 PDF 文件是否符合政府要求?

IronPDF 包含驗證工具,可檢查您的 PDF 是否符合第 508 節和 PDF/UA 要求,以協助您確保您的文件符合必要的無障礙標準。

是否可以使用 IronPDF 自動建立無障礙 PDF 檔案?

是的,IronPDF 可以整合到自動化工作流程中,持續產生易於存取的 PDF 文件,從而簡化滿足合規性標準的流程。

IronPDF 支援哪些程式語言來建立無障礙 PDF 檔案?

IronPDF 旨在與 C# 搭配使用,讓開發人員可以直接在 .NET Framework內建立可存取的 PDF。

有沒有如何使用 IronPDF 的教學?

是的,IronPDF 提供全面的教學和文檔,引導您完成建立無障礙 PDF 的過程,並有效利用其所有功能。

IronPDF能否幫助實現多語言PDF的無障礙訪問?

IronPDF 支援建立多語言無障礙 PDF,它能夠處理 Unicode 文字和語言,確保不同語言文件的可存取性。

Curtis Chau
技術作家

Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。

除了開發之外,Curtis 對物聯網 (IoT) 有著濃厚的興趣,探索將硬體和軟體結合的創新方式。在閒暇時間,他喜愛遊戲並構建 Discord 機器人,結合科技與創意的樂趣。

準備好開始了嗎?
Nuget 下載 18,120,209 | 版本: 2026.4 剛剛發布
Still Scrolling Icon

還在捲動嗎?

想要快速證明? PM > Install-Package IronPdf
執行範例 觀看您的 HTML 變成 PDF。