Commit 6a79f0f8 authored by Alain Vagner's avatar Alain Vagner Committed by Fred Chasen
Browse files

Accessibility improvements

parent 96b8aa1f
......@@ -40,6 +40,21 @@ class PostProcesser extends EventEmitter {
meta.producer = info.producer;
}
// Display the title of the document in the title bar by default
// See PDF/UA 1: 7.1-9
// See Matterhorn Protocol 1.1: Indices 07-001 & 07-002
if (meta.title) {
this.pdfDoc.catalog.set("ViewerPreferences",
new PDFLib.PDFDictionary({ DisplayDocTitle: PDFLib.PDFBoolean.fromBool(true) }, PDFLib.PDFObjectIndex.create()));
}
// Set the default language of the document
// See PDF/UA 1: 7.2-3
// See Matterhorn Protocol 1.1: Index 11-006
if (meta.lang) {
this.pdfDoc.catalog.set("Lang", PDFLib.PDFString.fromString(meta.lang));
}
// Add meta
this.addXmpMetadata(meta);
this.updateInfoDict(meta);
......
......@@ -36,7 +36,7 @@ class Printer extends EventEmitter {
async setup() {
let puppeteerOptions = {
headless: this.headless,
args: ["--disable-dev-shm-usage"],
args: ["--disable-dev-shm-usage", "--export-tagged-pdf"],
ignoreHTTPSErrors: this.ignoreHTTPSErrors
};
......@@ -303,6 +303,10 @@ class Printer extends EventEmitter {
if (title) {
meta.title = title.textContent.trim();
}
let lang = document.querySelector("html").getAttribute("lang");
if (lang) {
meta.lang = lang;
}
let metaTags = document.querySelectorAll("meta");
[...metaTags].forEach((tag) => {
if (tag.name) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment