Skip to content

Commit 4e87757

Browse files
committed
Added support PDF/A and PDF/UA - examples #950 #942
master commit: 9d93122
1 parent ca6f874 commit 4e87757

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

examples/pdfa.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
var fonts = {
2+
Roboto: {
3+
normal: 'fonts/Roboto-Regular.ttf',
4+
bold: 'fonts/Roboto-Medium.ttf',
5+
italics: 'fonts/Roboto-Italic.ttf',
6+
bolditalics: 'fonts/Roboto-MediumItalic.ttf'
7+
}
8+
};
9+
10+
var PdfPrinter = require('../src/printer');
11+
var printer = new PdfPrinter(fonts);
12+
var fs = require('fs');
13+
14+
var docDefinition = {
15+
version: '1.5', // PDF version
16+
subset: 'PDF/A-3a', // Subset types: // PDF/A-1, PDF/A-1a, PDF/A-1b, PDF/A-2, PDF/A-2a, PDF/A-2b, PDF/A-3, PDF/A-3a, PDF/A-3b, PDF/UA
17+
tagged: true, // Mark document as Tagged PDF
18+
displayTitle: true, // Display of document title in window title
19+
info: {
20+
title: 'Awesome PDF document from pdfmake'
21+
},
22+
content: [
23+
'PDF/A document for archive'
24+
]
25+
};
26+
27+
var now = new Date();
28+
var pdfDoc = printer.createPdfKitDocument(docDefinition);
29+
pdfDoc.pipe(fs.createWriteStream('pdfs/pdfa.pdf'));
30+
pdfDoc.end();
31+
32+
console.log(new Date() - now);

0 commit comments

Comments
 (0)