PDF/UA 規格による PDF アクセシビリティ

GdPicture.NET Document Imaging SDK を使用してタグ付き PDF を作成する

皆さん、こんにちは

アクセシビリティは、マテリアルにアクセスする能力に関係なく、ビジネスにおいて、さまざまな人々の間で分かりやすい文書を共有する必要がある場合に重要です。
障害を持つ人々がスクリーン リーダーのような支援技術を使用するだけでなく、 今日では、モバイル デバイスを使用する人々もカバーしています。
アクセシビリティはすべての人のためでもあります。
このソリューションは、タグ付き PDF ドキュメントを呼ばれます。

タグとは?

GdPicture.NET の最近のリリース (2018年 6月 21日以降) では、タグ付き PDF UA ドキュメントを作成できるように機能が拡張されました。これは何を意味するのでしょうか?
PDF ドキュメントは一般的なページ コンテンツに加えて構造が含まれることはよく知られていることです。
この構造は、ドキュメントのロジックを記述する、さまざまな命令を表しています。
それらは、画像、図、表、そのタイトルや有用な記述テキストなどの補足情報を保持することができます。
見出し、名前、フォントサイズ、フォントスタイルなど、セクションや段落に関する情報も保存できます。
それらは、実際のページ コンテンツと、含まれている情報に関係のないいくつかのグラフィックアイテムとを区別することを可能にします。
個々の文字、グラフィックス、注釈またはフォームフィールドなどのその他のオブジェクトを含む、テキストのようなドキュメント コンテンツの各部分は、ドキュメントの背後でこのような命令に付けることができます。これらの構造要素はタグと呼ばれます。

タグ ツリー

文書論理全体は、構造階層内に編成された、いわゆる論理構造ツリーまたはタグツリーと呼ばれるこれらの構造要素を使用して構成されます。

このオブジェクトは、可視のドキュメント コンテンツとは別に保存されます。 このようにして、すべてのタグは、そのページに配置された文書の可視部分を識別する関連アイテムとは無関係に処理されます。 このようなアプローチは、コンテンツ作成順序とは反対の文書コンテンツの論理的順序を生成します。 この論理的順序は、読み上げ順序の拡張として、ページ上のオブジェクト間の関係を理解するのに役立ちます。

PDF/UA とは?

PDF Association で説明されているように、PDF/UA は、アクセシビリティのために PDF タグを正しく使用することを定義する国際標準である ISO 14289 の一般的な名前です。 PDF/UA は、アクセシビリティに関連する PDF テクノロジーのコンポーネントとプロパティを識別し、その使用に関する要件と制限を提供します。
6月 21日以降、GdPicture.NET は PDF/Universal Accessibility (PDF/UA) の生成をサポートします。

PDF/UA 検証

PDF ドキュメントにタグを追加するのは複雑ではありません。 ただし、有効なタグ付き PDF ドキュメントを作成するために、それらを正しく添付するのは難しいです。
幸いにも、利用可能な多くの無料の PDF/UA 検証ツールがあり、生成されたタグのツリーを検証することができます。 いくつかの例がここにあります。

タグ付き PDF および PDF/UA の利点

タグ付きの PDF 文書は、さまざまな画面やモバイル デバイス上で表示されるとき、かなりよく適合します。
これらは、障害のある人々に役立つように非常にうまくスクリーンリーダー用に準備されています。
さらに、PDF 文書の 508 準拠を達成するためには、タグが必要です。
最後に、PDF/UA 準拠のドキュメントでは、WCAG 2.0 と呼ばれる Web のアクセシビリティ要件に非常に近づいています。

ますます多くの企業や組織、特に行政機関では、PDF アクセシブル文書を使用して誰でもアクセスできるようにすることを求められています。

アクセシブルにする準備はできていますか? 今すぐ GdPicture.NET ツールキットでタグの使用を始めてください!

リソースとメソッド

PDF アクセシビリティと PDF/UA の詳細を知りたい場合は、PDF Association の Web サイトで以下のページをご覧ください。
https://www.pdfa.org/working-group/pdfua-competence-center/
https://www.pdfa.org/publication/pdfua-flyer/
https://www.pdfa.org/publication/pdfua-reference-suite/

2006年に PDF/A Competence Center として設立された PDF Association は、PDF 技術の国際規格の採用と実施を促進するために存在します。

タグ付けおよびアクセシブル PDF を生成するための GdPictureメソッド:
AttachTagToAnnotation メソッド (GdPicturePDF)
SetTagAttribute(Int32,String,String) メソッド
スクラッチからタグ付き PDF ドキュメントを作成する

サンプル コード (C#)

[code language=”bash”]

//We assume that GdPicture has been correctly installed and unlocked.
using (GdPicturePDF oGdPicturePDF = new GdPicturePDF())
{
//Creating a new PDF document.
if ((oGdPicturePDF.NewPDF(PdfConformance.PDF_UA_1) == GdPictureStatus.OK) &&
(oGdPicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) == GdPictureStatus.OK))
{
//This is required to have a valid PDF_UA document.
oGdPicturePDF.SetTitle("My first PDF/UA document");
// Add the font for drawing a text.
string fontResName = oGdPicturePDF.AddTrueTypeFontU("Arial", false, false, true);
oGdPicturePDF.SetTextSize(18);
//Adding the first image to the PDF document.
string logo1 = oGdPicturePDF.AddJpegImageFromFile("brand1.jpg");
if (oGdPicturePDF.GetStat() == GdPictureStatus.OK)
{
//Adding the second image to the PDF document.
string logo2 = oGdPicturePDF.AddJpegImageFromFile("brand2.jpg");
if (oGdPicturePDF.GetStat() == GdPictureStatus.OK)
{
//Creating a root tag and set the language.
int tagRootID = oGdPicturePDF.GetTagRootID();
if ((oGdPicturePDF.GetStat() != GdPictureStatus.OK) ||
(oGdPicturePDF.SetLanguage("en-US") != GdPictureStatus.OK))
goto error;
//Creating a section tag for the document content.
int tagSection = oGdPicturePDF.NewTag(tagRootID, "Sect");
if (oGdPicturePDF.GetStat() != GdPictureStatus.OK) goto error;
//Creating a tag for the text of the sentence.
if ((oGdPicturePDF.BeginMarkedContentSequence(tagSection, "Span") != GdPictureStatus.OK) ||
(oGdPicturePDF.DrawText(fontResName, 20, 750, "The product") != GdPictureStatus.OK) ||
(oGdPicturePDF.EndMarkedContent() != GdPictureStatus.OK))
goto error;
//Creating a tag and setting its properties for the first image.
int tagLogo1 = oGdPicturePDF.NewTag(tagSection, "Figure");
if (oGdPicturePDF.GetStat() != GdPictureStatus.OK) goto error;
if ((oGdPicturePDF.SetTagAlternateDescription(tagLogo1, "This is a logo of brand1.") != GdPictureStatus.OK) ||
(oGdPicturePDF.SetTagAttribute(tagLogo1, "BBox", new double[] { 125, 750, 221.75, 771.75 }) != GdPictureStatus.OK))
goto error;
//Creating a tag for the image itself and drawing the image.
if ((oGdPicturePDF.BeginMarkedContentSequence(tagLogo1, "Figure") != GdPictureStatus.OK) ||
(oGdPicturePDF.DrawImage(logo1, 125, 750, 96.75f, 21.75f) != GdPictureStatus.OK) ||
(oGdPicturePDF.EndMarkedContent() != GdPictureStatus.OK))
goto error;
//Creating a tag for the text of the sentence.
if ((oGdPicturePDF.BeginMarkedContentSequence(tagSection, "Span") != GdPictureStatus.OK) ||
(oGdPicturePDF.DrawText(fontResName, 230, 750, "is powered by") != GdPictureStatus.OK) ||
(oGdPicturePDF.EndMarkedContent() != GdPictureStatus.OK))
goto error;
//Creating a tag and setting its properties for the second image.
int tagLogo2 = oGdPicturePDF.NewTag(tagSection, "Figure");
if (oGdPicturePDF.GetStat() != GdPictureStatus.OK) goto error;
if ((oGdPicturePDF.SetTagAlternateDescription(tagLogo2, "This is a logo of brand2.") != GdPictureStatus.OK) ||
(oGdPicturePDF.SetTagAttribute(tagLogo2, "BBox", new double[] { 350, 750, 446.75, 771.75 }) != GdPictureStatus.OK))
goto error;
//Creating a tag for the image itself and drawing the image.
if ((oGdPicturePDF.BeginMarkedContentSequence(tagLogo2, "Figure") != GdPictureStatus.OK) ||
(oGdPicturePDF.DrawImage(logo2, 350, 750, 96.75f, 21.75f) != GdPictureStatus.OK) ||
(oGdPicturePDF.EndMarkedContent() != GdPictureStatus.OK))
goto error;
error:
if (oGdPicturePDF.GetStat() == GdPictureStatus.OK)
{
//Saving the created document.
if (oGdPicturePDF.SaveToFile("tagged_document.pdf") == GdPictureStatus.OK)
MessageBox.Show("Your tagged PDF document has been successfully created.", "Creating a Tagged PDF Example", MessageBoxButtons.OK, MessageBoxIcon.Information);
else
MessageBox.Show("The error occured when saving. Error: " + oGdPicturePDF.GetStat().ToString(), "Creating a Tagged PDF Example", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
MessageBox.Show("The error occured when creating tags. Error: " + oGdPicturePDF.GetStat().ToString(), "Creating a Tagged PDF Example", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
MessageBox.Show("The error occured when adding the second image. Error: " + oGdPicturePDF.GetStat().ToString(), "Creating a Tagged PDF Example", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
MessageBox.Show("The error occured when adding the first image. Error: " + oGdPicturePDF.GetStat().ToString(), "Creating a Tagged PDF Example", MessageBoxButtons.OK, MessageBoxIcon.Error);
oGdPicturePDF.CloseDocument();
}
else
MessageBox.Show("The new document can’t be created. Error: " + oGdPicturePDF.GetStat().ToString(), "Creating a Tagged PDF Example", MessageBoxButtons.OK, MessageBoxIcon.Error);
}

[/code]

ありがとうございました。

参照記事:「PDF Accessibility with PDF/UA Generation」2018/6/26
GdPicture.NET 製品ページ: https://www.xlsoft.com/jp/products/orpalis/gdpicture.html

タイトルとURLをコピーしました