如何使用 IronPDF 在 C# 中建立符合第 508 條規定且無障礙的 PDF 檔案

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

使用 IronPDF 在 C# .NET生成無障礙 PDF,可直接產生符合 PDF/UA 標準的文件,並滿足《第 508 條》WCAG 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 文件必須通過 Section 508 審核、PDF/UA (ISO 14289) 驗證,或符合 WCAG 2.0 AA 級要求
  • 技術層面的重要性:標準 PDF 缺乏語義結構。 IronPDF 能從結構完善的 HTML 中,自動建立螢幕閱讀器所需的標記內容樹。

僅需幾行程式碼,即可建立符合《第 508 條》規範的 PDF/UA 文件:

  1. using 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 以快速安裝。該套件下載量已突破 1,000 萬次,正透過 C# 徹底改變 PDF 開發領域。 您亦可下載 DLL 檔案或 Windows 安裝程式

目錄


何謂第 508 條合規性?它對 PDF 檔案為何重要?

第 508 條係指 1998 年對《1973 年康復法案》所做的修正。這項聯邦法律規定,所有由聯邦機構開發、採購、維護或使用的電子及資訊技術,均須確保身心障礙者能夠無障礙地使用。 其適用範圍不僅限於政府機關本身。 任何接受聯邦資金、與聯邦機構簽訂合約,或向政府機構提供技術服務的組織,亦須遵守此規定。

其實際影響相當重大。 為聯邦醫療保健計畫開發軟體的承包商,不能僅僅交付在螢幕上看起來正確的 PDF 報告。 這些文件必須能被螢幕閱讀器讀取、透過鍵盤操作,並以輔助技術可解析的方式進行結構化。 若未能符合這些要求,可能導致交付成果被拒、合約流失,甚至面臨法律訴訟。

PDF 檔案在無障礙存取方面存在獨特的挑戰。 與瀏覽器透過內建無障礙功能渲染的 HTML 網頁不同,PDF 檔案是自包含的文件,必須自行攜帶結構資訊。 一份視覺上看似完美的 PDF,若缺乏適當的標籤、邏輯閱讀順序或圖片替代文字,對於依賴螢幕閱讀器的使用者而言,可能完全無法使用。

不遵守規範的後果不僅限於法律風險。 製作出無法無障礙存取的文件,等同於有效排除其受眾中的相當大一部分。 根據世界衛生組織的數據,全球約有 16% 的人口患有某種形式的殘疾。 對於政府服務及聯邦資助的計畫而言,排除這些個人不僅是不良做法,更是對公民權利保障的侵犯。

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

理解不同無障礙標準之間的關聯性,有助於釐清開發人員實際需要實作的內容。 在討論無障礙 PDF 時,有三項關鍵標準相互交織:第 508 條、WCAG 以及 PDF/UA。

《網頁內容無障礙指南》(Web Content Accessibility Guidelines),通常簡稱為 WCAG,源自萬維網聯盟(World Wide Web Consortium)。 這些準則確立了使數位內容具備可感知性、可操作性、可理解性及穩健性的原則。雖然 WCAG 主要針對網頁內容設計,但其原則同樣適用於 PDF 文件。 2017 年修訂的《第 508 條標準》已直接將 WCAG 2.0 AA 級納入為合規的技術基準。 這意味著符合 WCAG 2.0 AA 標準,實質上等同於符合電子文件之《第 508 條》規範。

PDF/UA(全稱 PDF/Universal Accessibility)是一項 ISO 標準(ISO 14289),專為可無障礙存取的 PDF 文件而設計。 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/A 檔案。

該程式碼建立一個 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 檔案,並協助螢幕閱讀器識別文件語言。 諸如 h1、h2 和 p 等語義 HTML 元素將直接轉換為相應的 PDF 標籤,形成邏輯清晰的文件結構,以便輔助技術進行導航。

若需渲染 HTML 檔案URL 而非字串,IronPDF 提供了相應的方法。

以下程式碼展示了兩種方法: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

Title 屬性值得特別注意。 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 屬性指定語言。 常見語言代碼包括 pt (葡萄牙語)、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 表示有序清單。 每個 li 元素在 PDF/A 中將轉為帶標籤的清單項目。 輔助技術會透過宣告清單所含項目數量,並依序朗讀每個項目來讀取清單。

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

圖片的無障礙性構成了一項根本性的挑戰。 視障或低視力使用者無法感知視覺內容。 替代文字(通常稱為 alt 文字)提供文字描述,可在無法顯示圖片時代為朗讀。

當從 HTML 生成 PDF/A 時,img 元素上的 alt 屬性會作為替代文字保留在 PDF/A 中。

此程式碼會建立一份包含兩張圖表的銷售報告。 每個 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

撰寫有效的替代文字(alt text)需要理解圖片所傳達的資訊。 針對圖表與圖形,替代文字應描述所呈現的數據,而非僅陳述圖表的存在。 僅稱"條形圖"並無實質意義。 描述"比較四個地區第三季銷售額的條形圖,其中西部地區以 320 萬美元領先"的說明,能讓視障使用者獲得與明眼人查看圖表時相同的洞察。

不具資訊功能的裝飾性圖片應設定為空的 alt 屬性。 此標記會告知螢幕閱讀器可跳過該圖片:

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

如何在 PDF 文件中建立符合無障礙標準的表格?

表格因以二維形式編碼資料間的關聯性,故在無障礙設計方面涉及複雜的考量。 視力正常的用戶可以透過視覺掃描行與列,來理解儲存格與其標題之間的關聯。 依賴輔助技術的使用者需要透過正確的標記,明確定義此關聯性。

HTML 提供了可存取表格所需的結構元素。 關鍵元素包括用於標題儲存格的 th、用於資料儲存格的 td,以及用來明確標示標題適用於行或列的 scope 屬性。

此程式碼建立了一個附有正確無障礙標記的員工名錄表格。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 元素為表格提供標題,該標題會在讀取表格內容前被朗讀出來。 這能讓使用者了解即將聽到的內容背景。

對於包含合併儲存格或結構不規則的表格,可透過新增標題 (header) 和識別碼 (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 表單採用正確的無障礙設計模式:每個輸入欄位皆具備與其標籤 for 屬性相符的唯一 id 值;單選鈕以 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 鍵移至該欄位時,讀出"全名,編輯文字"。 單選鈕會分組置於 fieldset 內,並附有說明該組別用途的標籤。 核取方塊的標籤位置位於輸入元素之後,符合標準表單規範。

必須啟用 CreatePdfFormsFromHtml 渲染選項,才能讓 IronPDF 建立互動式表單欄位,而非僅呈現表單的靜態樣式。

生成後如何驗證 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 並非免費軟體,但在 Enterprise 環境中相當普遍,且能針對無障礙問題提供詳細的報告。

對於自動化測試管道,PDF/UA 基金會提供的 PAC(PDF 無障礙檢查器)工具提供了另一種驗證選項。 PAC 同時提供圖形介面與命令列功能,使其適合整合至持續整合工作流程中。

在 Enterprise 應用程式中,維持無障礙 PDF 的最佳實踐有哪些?

一旦掌握相關技巧,建立單一且符合無障礙標準的文件便相當簡單。 要在Enterprise層面大規模維持無障礙環境,需要系統化的方法與組織紀律。

透過模板標準化,可減少差異並確保一致性。 建立一個包含經核准 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 的第 508 條合規性是指什麼?

第 508 條合規性確保電子與資訊技術(例如 PDF)能讓身心障礙者無障礙地使用。IronPDF 透過讓您添加替代文字、建立無障礙表格等功能,協助建立符合這些標準的 PDF 檔案。

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

IronPDF 提供將現有 PDF 轉換為 PDF/UA 的功能,確保其符合無障礙標準。這包括添加必要的元資料及結構化元素,以實現內容的無障礙存取。

IronPDF 能否協助渲染符合無障礙標準的 HTML?

是的,IronPDF 能夠渲染符合 PDF/UA 標準且具無障礙功能的 HTML 內容,使您能更輕鬆地從網頁內容建立無障礙文件。

如何使用 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 擁有卡爾頓大學(Carleton University)的電腦科學學士學位,專精於前端開發,並精通 Node.js、TypeScript、JavaScript 及 React。他熱衷於打造直觀且美觀的用戶介面,喜歡運用現代框架,並創建結構完善、視覺上吸引人的手冊。

除了開發工作之外,Curtis 對物聯網(IoT)抱有濃厚興趣,致力於探索整合硬體與軟體的創新方法。閒暇時,他喜歡玩遊戲和開發 Discord 機器人,將對科技的熱愛與創意相結合。

準備開始了嗎?
Nuget 下載 18,918,602 | 版本: 2026.5 just released
Still Scrolling Icon

還在往下捲動嗎?

想要快速確認成果嗎? PM > Install-Package IronPdf
執行範例 觀看您的 HTML 轉為 PDF。