-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added PDF/UA subset and its metadata * Added PDF/UA metadata unit tests * Added PDF/UA subset to accessibility docs * Updated change log for PDF/UA subset
- Loading branch information
1 parent
5bbd9a1
commit 408dc4e
Showing
5 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
export default { | ||
|
||
initPDFUA() { | ||
this.subset = 1; | ||
}, | ||
|
||
endSubset() { | ||
this._addPdfuaMetadata(); | ||
}, | ||
|
||
_addPdfuaMetadata() { | ||
this.appendXML(this._getPdfuaid()); | ||
}, | ||
|
||
_getPdfuaid() { | ||
return ` | ||
<rdf:Description xmlns:pdfuaid="http://www.aiim.org/pdfua/ns/id/" rdf:about=""> | ||
<pdfuaid:part>${this.subset}</pdfuaid:part> | ||
</rdf:Description> | ||
`; | ||
}, | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import PDFDocument from '../../lib/document'; | ||
import { logData } from './helpers'; | ||
|
||
describe('PDF/UA', () => { | ||
|
||
test('metadata is present', () => { | ||
let options = { | ||
autoFirstPage: false, | ||
pdfVersion: '1.7', | ||
subset: 'PDF/UA', | ||
tagged: true | ||
}; | ||
let doc = new PDFDocument(options); | ||
const data = logData(doc); | ||
doc.end(); | ||
expect(data).toContainChunk([ | ||
`11 0 obj`, | ||
`<<\n/length 841\n/Type /Metadata\n/Subtype /XML\n/Length 843\n>>` | ||
]); | ||
}); | ||
|
||
test('metadata constains pdfuaid part', () => { | ||
let options = { | ||
autoFirstPage: false, | ||
pdfVersion: '1.7', | ||
subset: 'PDF/UA', | ||
tagged: true | ||
}; | ||
let doc = new PDFDocument(options); | ||
const data = logData(doc); | ||
doc.end(); | ||
let metadata = Buffer.from(data[24]).toString(); | ||
|
||
expect(metadata).toContain('pdfuaid:part>1'); | ||
}); | ||
|
||
}); |