使用 C# 建立無障礙 PDF 並符合 Section 508 標準

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

IronPDF使開發人員能夠使用 Google Chromium 的渲染引擎建立符合 Section 508 標準且易於存取的 PDF,只需簡單的一行 SaveAsPdfUA() 方法呼叫即可支援 PDF/UA 標準。

IronPDF回應了Google的倡議,旨在提高 PDF 可訪問性和符合第 508 條款的要求。 該庫提供了一個全面的解決方案,用於生成符合聯邦要求的無障礙 PDF 文件,並確保殘疾人士可以使用這些文件。 IronPDF利用現代網路標準和 Google 的輔助功能改進,讓.NET開發人員能夠輕鬆實現合規性。

快速入門:使用IronPDF建立無障礙 PDF

使用IronPDF以最少的程式碼建立符合 Section 508 標準的 PDF 檔案。 本快速入門指南示範如何在 C# 中產生可存取的 PDF,提供了在 PDF 文件中實現可存取性的直接方法。

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

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

    IronPdf.PdfDocument.FromFile("input.pdf").SaveAsPdfUA("output-accessible.pdf");
  3. 部署到您的生產環境進行測試

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

    arrow pointer

如何使 PDF 文件易於存取並符合第 508 條款?

2021年,我們改用GoogleChromium HTML渲染引擎,從HTML渲染PDF檔。這使得我們的軟體能夠繼承Google已實現的無障礙功能

無障礙 PDF 檔案需要特定的結構元素,以便螢幕閱讀器和輔助技術能夠正確解讀文件內容。 這些要素包括:

-標記內容結構,定義閱讀順序與層級結構

  • 圖像和非文字元素的替代文本 -正確的航向結構(H1、H2、H3)用於導航
  • 螢幕閱讀器發音的語言規範 -符合邏輯的閱讀順序,遵循自然的內容流程
  • 文字與背景之間具有高對比

PDF/UA(通用無障礙)標準代表了無障礙 PDF 文件的國際基準。 使用 SaveAsPdfUA() 方法時, IronPDF會自動產生符合這些要求的 PDF。

為什麼PDF/UA合規性對商業應用至關重要?

在美國,聯邦機構和承包商必須遵守第 508 條。 各組織必須確保其數位內容(包括 PDF 文件)能夠被殘疾員工和客戶存取。 不遵守規定可能導致:

  • 根據《美國殘疾人法案》(ADA)可能面臨的法律處罰和訴訟。 聯邦合約和商業機會的損失
  • 20%的殘疾人口被排除在外
  • 損害品牌聲譽和客戶信任

IronPDF透過自動處理無障礙 PDF 產生的技術要求,簡化了合規性流程。 此程式庫可確保正確的文件結構、元資料和標籤,而無需開發人員了解 PDF/UA 規範的複雜性。

IronPDF如何繼承Google的輔助功能?

IronPDF利用了 Google Chromium 的渲染引擎,其中包含內建的輔助功能。 當 HTML 轉換為 PDF 時,Chrome 引擎會:

1.保持語意化的 HTML 結構-維護標題、清單和表格的含義 2.傳遞 ARIA 屬性- 將輔助功能屬性對應到 PDF 標籤 3.保持閱讀順序- 分析 CSS 佈局以確保內容邏輯流暢 4.能夠處理複雜的佈局-正確標記多列文字和浮動元素

以下是一個使用語意化 HTML 建立可存取 PDF 的範例:

using IronPdf;

// Create renderer with accessibility-focused settings
var renderer = new ChromePdfRenderer();

// HTML with proper semantic structure
string accessibleHtml = @"
<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='UTF-8'>
    <title>Annual Report 2024</title>
</head>
<body>
    <header>
        <h1>Annual Financial Report</h1>
        <nav aria-label='Document navigation'>
            <ul>
                <li><a href='#summary'>Executive Summary</a></li>
                <li><a href='#finances'>Financial Overview</a></li>
            </ul>
        </nav>
    </header>

    <main>
        <section id='summary'>
            <h2>Executive Summary</h2>
            <p>This report provides a comprehensive overview of our financial performance.</p>
        </section>

        <section id='finances'>
            <h2>Financial Overview</h2>
            <table>
                <caption>Quarterly Revenue Breakdown</caption>
                <thead>
                    <tr>
                        <th scope='col'>Quarter</th>
                        <th scope='col'>Revenue</th>
                        <th scope='col'>Growth</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>Q1 2024</td>
                        <td>$1.2M</td>
                        <td>15%</td>
                    </tr>
                </tbody>
            </table>
        </section>
    </main>
</body>
</html>";

// Render to PDF and save as accessible PDF/UA
var pdf = renderer.RenderHtmlAsPdf(accessibleHtml);
pdf.SaveAsPdfUA("accessible-annual-report.pdf");
using IronPdf;

// Create renderer with accessibility-focused settings
var renderer = new ChromePdfRenderer();

// HTML with proper semantic structure
string accessibleHtml = @"
<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='UTF-8'>
    <title>Annual Report 2024</title>
</head>
<body>
    <header>
        <h1>Annual Financial Report</h1>
        <nav aria-label='Document navigation'>
            <ul>
                <li><a href='#summary'>Executive Summary</a></li>
                <li><a href='#finances'>Financial Overview</a></li>
            </ul>
        </nav>
    </header>

    <main>
        <section id='summary'>
            <h2>Executive Summary</h2>
            <p>This report provides a comprehensive overview of our financial performance.</p>
        </section>

        <section id='finances'>
            <h2>Financial Overview</h2>
            <table>
                <caption>Quarterly Revenue Breakdown</caption>
                <thead>
                    <tr>
                        <th scope='col'>Quarter</th>
                        <th scope='col'>Revenue</th>
                        <th scope='col'>Growth</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>Q1 2024</td>
                        <td>$1.2M</td>
                        <td>15%</td>
                    </tr>
                </tbody>
            </table>
        </section>
    </main>
</body>
</html>";

// Render to PDF and save as accessible PDF/UA
var pdf = renderer.RenderHtmlAsPdf(accessibleHtml);
pdf.SaveAsPdfUA("accessible-annual-report.pdf");
Imports IronPdf

' Create renderer with accessibility-focused settings
Dim renderer As New ChromePdfRenderer()

' HTML with proper semantic structure
Dim accessibleHtml As String = "
<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='UTF-8'>
    <title>Annual Report 2024</title>
</head>
<body>
    <header>
        <h1>Annual Financial Report</h1>
        <nav aria-label='Document navigation'>
            <ul>
                <li><a href='#summary'>Executive Summary</a></li>
                <li><a href='#finances'>Financial Overview</a></li>
            </ul>
        </nav>
    </header>

    <main>
        <section id='summary'>
            <h2>Executive Summary</h2>
            <p>This report provides a comprehensive overview of our financial performance.</p>
        </section>

        <section id='finances'>
            <h2>Financial Overview</h2>
            <table>
                <caption>Quarterly Revenue Breakdown</caption>
                <thead>
                    <tr>
                        <th scope='col'>Quarter</th>
                        <th scope='col'>Revenue</th>
                        <th scope='col'>Growth</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>Q1 2024</td>
                        <td>$1.2M</td>
                        <td>15%</td>
                    </tr>
                </tbody>
            </table>
        </section>
    </main>
</body>
</html>"

' Render to PDF and save as accessible PDF/UA
Dim pdf = renderer.RenderHtmlAsPdf(accessibleHtml)
pdf.SaveAsPdfUA("accessible-annual-report.pdf")
$vbLabelText   $csharpLabel

目前支援哪些無障礙標準?

IronPDF支援多種無障礙標準,以滿足各種合規性要求:

  1. PDF/UA-1 - 透過 SaveAsPdfUA() 實現可存取 PDF 的主要標準
  2. WCAG 2.1 AA 級- 當來源 HTML 符合 WCAG 標準時符合要求 3.第 508 條更新(2018 年) - 美國 符合 WCAG 2.0 標準的聯邦要求
  3. EN 301 549 - 歐洲資訊通訊技術產品無障礙標準

該庫還支援UTF-8 和國際語言,確保不同語言和字元集的可存取性。

如何匯出符合無障礙標準的PDF文件?

IronPDF提供多種匯出選項,以滿足不同的合規性要求。 目前,您可以匯出符合 PDF/A-3b 標準的文件。 請閱讀我們關於使用IronPDF進行 PDF/A 歸檔的文章,以了解更多資訊。

using IronPdf;

// Load or create a PDF document
var pdf = PdfDocument.FromFile("source-document.pdf");

// Export as PDF/UA for accessibility compliance
pdf.SaveAsPdfUA("accessible-output.pdf");

// Export as PDF/A for long-term archiving with accessibility
pdf.SaveAsPdfA("archived-accessible.pdf", PdfAVersions.PdfA3);

// Set document metadata for better accessibility
pdf.Metadata.Title = "2024 Accessibility Report";
pdf.Metadata.Author = "Compliance Department";
pdf.Metadata.Subject = "Annual accessibility compliance documentation";
pdf.Metadata.Keywords = "accessibility, Section 508, compliance, PDF/UA";
pdf.Metadata.Language = "en-US";

// Save with metadata
pdf.SaveAs("document-with-metadata.pdf");
using IronPdf;

// Load or create a PDF document
var pdf = PdfDocument.FromFile("source-document.pdf");

// Export as PDF/UA for accessibility compliance
pdf.SaveAsPdfUA("accessible-output.pdf");

// Export as PDF/A for long-term archiving with accessibility
pdf.SaveAsPdfA("archived-accessible.pdf", PdfAVersions.PdfA3);

// Set document metadata for better accessibility
pdf.Metadata.Title = "2024 Accessibility Report";
pdf.Metadata.Author = "Compliance Department";
pdf.Metadata.Subject = "Annual accessibility compliance documentation";
pdf.Metadata.Keywords = "accessibility, Section 508, compliance, PDF/UA";
pdf.Metadata.Language = "en-US";

// Save with metadata
pdf.SaveAs("document-with-metadata.pdf");
Imports IronPdf

' Load or create a PDF document
Dim pdf = PdfDocument.FromFile("source-document.pdf")

' Export as PDF/UA for accessibility compliance
pdf.SaveAsPdfUA("accessible-output.pdf")

' Export as PDF/A for long-term archiving with accessibility
pdf.SaveAsPdfA("archived-accessible.pdf", PdfAVersions.PdfA3)

' Set document metadata for better accessibility
pdf.Metadata.Title = "2024 Accessibility Report"
pdf.Metadata.Author = "Compliance Department"
pdf.Metadata.Subject = "Annual accessibility compliance documentation"
pdf.Metadata.Keywords = "accessibility, Section 508, compliance, PDF/UA"
pdf.Metadata.Language = "en-US"

' Save with metadata
pdf.SaveAs("document-with-metadata.pdf")
$vbLabelText   $csharpLabel

針對不同的合規性要求,我應該使用哪些PDF標準?

不同的行業和司法管轄區對PDF標準有不同的要求:

-政府/聯邦承包商PDF/UA 以及 PDF/A-3,以實現可訪問性和可保存性 -醫療保健(HIPAA)PDF/UA,採用加密和密碼保護 -金融服務PDF/A-3b 包含嵌入式來源數據 -教育PDF/UA 用於無障礙學生材料 -法律文件PDF/A 用於具有無障礙功能的法院文件

了解更多關於設定元資料和文件屬性以增強可訪問性的信息。

如何將現有 PDF 檔案轉換為無障礙格式?

將舊版 PDF 檔案轉換為無障礙格式需要仔細考慮文件結構:

using IronPdf;
using System.Collections.Generic;

// Load existing PDF
var existingPdf = PdfDocument.FromFile("legacy-document.pdf");

// Add document structure and metadata
existingPdf.Metadata.Title = "Converted Accessible Document";
existingPdf.Metadata.Language = "en-US";

// Extract and re-render for better structure (if original lacks tags)
string extractedHtml = existingPdf.ExtractHtmlString();

// Create new accessible version
var renderer = new ChromePdfRenderer()
{
    RenderingOptions = new ChromePdfRenderOptions()
    {
        MarginTop = 40,
        MarginBottom = 40,
        EnableJavaScript = true,
        RenderDelay = 500 // Allow time for JavaScript rendering
    }
};

// Re-render with proper structure
var accessiblePdf = renderer.RenderHtmlAsPdf(extractedHtml);
accessiblePdf.SaveAsPdfUA("converted-accessible.pdf");
using IronPdf;
using System.Collections.Generic;

// Load existing PDF
var existingPdf = PdfDocument.FromFile("legacy-document.pdf");

// Add document structure and metadata
existingPdf.Metadata.Title = "Converted Accessible Document";
existingPdf.Metadata.Language = "en-US";

// Extract and re-render for better structure (if original lacks tags)
string extractedHtml = existingPdf.ExtractHtmlString();

// Create new accessible version
var renderer = new ChromePdfRenderer()
{
    RenderingOptions = new ChromePdfRenderOptions()
    {
        MarginTop = 40,
        MarginBottom = 40,
        EnableJavaScript = true,
        RenderDelay = 500 // Allow time for JavaScript rendering
    }
};

// Re-render with proper structure
var accessiblePdf = renderer.RenderHtmlAsPdf(extractedHtml);
accessiblePdf.SaveAsPdfUA("converted-accessible.pdf");
Imports IronPdf
Imports System.Collections.Generic

' Load existing PDF
Dim existingPdf = PdfDocument.FromFile("legacy-document.pdf")

' Add document structure and metadata
existingPdf.Metadata.Title = "Converted Accessible Document"
existingPdf.Metadata.Language = "en-US"

' Extract and re-render for better structure (if original lacks tags)
Dim extractedHtml As String = existingPdf.ExtractHtmlString()

' Create new accessible version
Dim renderer = New ChromePdfRenderer() With {
    .RenderingOptions = New ChromePdfRenderOptions() With {
        .MarginTop = 40,
        .MarginBottom = 40,
        .EnableJavaScript = True,
        .RenderDelay = 500 ' Allow time for JavaScript rendering
    }
}

' Re-render with proper structure
Dim accessiblePdf = renderer.RenderHtmlAsPdf(extractedHtml)
accessiblePdf.SaveAsPdfUA("converted-accessible.pdf")
$vbLabelText   $csharpLabel

建立無障礙 PDF 時常見的問題有哪些?

導致 PDF 檔案無法滿足無障礙標準的常見問題:

1.缺少替代文字:圖片缺少描述 2.閱讀順序錯誤:複雜的佈局會使輔助科技感到困惑 3.色彩對比差:低對比度會降低可讀性 4.缺少語言聲明:螢幕閱讀器需要語言訊息 5.表格結構不當:表格缺少表頭和作用域屬性

IronPDF透過保留語意化的 HTML 結構並自動產生正確的 PDF 標籤來避免這些問題。

如何獲得輔助功能支援?

聯絡我們的開發者支援團隊,了解如何改善輔助功能。 我們的工程團隊會根據開發者的回饋和不斷發展的標準,積極改進功能。 請提交詳細的支援請求,內容包括:

  • 您所在行業的具體無障礙要求
  • PDF/UA 驗證工具相關的問題
  • 自訂標籤或結構需求
  • 與無障礙測試工具集成

聯絡客服前,請確保您已具備以下條件: 1.已更新至最新版本的IronPDF 2.應用您的許可證密鑰以獲得全部功能

  1. 使用能夠重現問題的範例文件進行了測試。
  2. 收集的錯誤訊息或驗證報告

我應該何時聯繫技術支援諮詢無障礙訪問問題?

遇到以下情況請聯絡支援人員:

-驗證失敗:PDF 檔案未通過 PAC 3 或 Adob​​e 無障礙檢查器測試 螢幕閱讀器問題:輔助科技無法讀取文檔 -合規性問題:需要監理要求的指導 -效能問題:大型可存取文件會導致問題 -客製化需求:超出標準合規性範圍的獨特無障礙需求

未來計劃推出哪些輔助功能?

IronPDF 的發展路線圖包括持續改善其可訪問性:

  • 增強了對數學公式和科學計數法的支持
  • 改進了表單欄位處理,標籤更清晰
  • 針對複雜資料關係的高階表格標記
  • 自動產生輔助使用報告
  • 與無障礙測試 API 集成
  • 支援新興的 PDF 2.0 輔助功能

請分享您的無障礙需求,以便我們優先考慮未來的開發工作。

常見問題解答

什麼是 Section 508 規範,為什麼它對 PDF 文件很重要?

Section 508 規範是美國聯邦規定,以確保殘障人士能存取數位內容。對 PDF 而言,這意味著包括適當的文件結構、圖片的替代文字以及邏輯的閱讀順序。IronPDF 使用其 SaveAsPdfUA() 方法自動處理這些要求,幫助組織避免法律懲罰,並確保其文件可供所有使用者存取。

如何建立符合 Section 508 要求的可存取 PDF?

使用 IronPDF 创建可访問的 PDF 非常簡单。只需一行代碼,您就可以將任何現有的 PDF 轉換成符合 Section 508 的 PDF:IronPdf.PdfDocument.FromFile("input.pdf").SaveAsPdfUA("output-accessible.pdf").此方法可自動加入所有所需的輔助功能,包括適當的標籤、結構和元資料。

生成 PDF 時會自動包含哪些輔助功能?

IronPDF 自動包含基本的可讀性功能,例如:適當閱讀順序的標記內容結構、圖片的替代文字、適當的標題層次(H1、H2、H3)、螢幕閱讀器的語言規格、邏輯閱讀順序以及適當的對比度。這些功能透過 Google Chromium 的渲染引擎來實現,IronPDF 利用該引擎來產生 PDF。

什麼是 PDF/UA,它與可存取的 PDF 有何關聯?

PDF/UA (Universal Accessibility) 是可存取 PDF 文件的國際標準。它定義了 PDF 與屏幕閱讀器等輔助技術相容的技術要求。IronPDF 的 SaveAsPdfUA() 方法可自動生成符合 PDF/UA 標準的 PDF,確保您的文件同時符合國際可讀性指南和 Section 508 的要求。

不建立可存取 PDF 的商業風險為何?

不遵守可訪問性標準可能會導致嚴重後果,包括根據 ADA 受到法律處罰、失去聯邦合約、約 20% 的殘障人士被排除在外,以及品牌聲譽受損。IronPDF 可自動確保您的 PDF 符合可存取性要求,而無需具備廣泛的 PDF/UA 規格技術知識,有助於降低這些風險。

圖書館如何自動處理複雜的可存取性要求?

IronPDF 利用 Google Chromium 的 HTML 渲染引擎,繼承了 Google 廣泛的可讀性改進。當您使用 SaveAsPdfUA() 方法時,函式庫會自動處理複雜的需求,例如適當的文件標籤、元資料插入、閱讀順序建立,以及結構層次 - 所有這些都不需要開發人員瞭解 PDF 可存取性標準的複雜細節。

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。