-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
Copy pathstandardfonts.js
44 lines (34 loc) · 1.16 KB
/
standardfonts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
var pdfmake = require('../js/index'); // only during development, otherwise use the following line
//var pdfmake = require('pdfmake');
var Courier = require('../standard-fonts/Courier');
pdfmake.addFonts(Courier);
var Helvetica = require('../standard-fonts/Helvetica');
pdfmake.addFonts(Helvetica);
var Times = require('../standard-fonts/Times');
pdfmake.addFonts(Times);
//var Symbol = require('../standard-fonts/Symbol');
//pdfmake.addFonts(Symbol);
//var ZapfDingbats = require('../standard-fonts/ZapfDingbats');
//pdfmake.addFonts(ZapfDingbats);
var docDefinition = {
content: [
{ text: 'Standard fonts supports only ANSI code page (only english characters)!', bold: true },
' ',
{ text: 'Courier font', font: 'Courier' },
{ text: 'Helvetica font', font: 'Helvetica' },
{ text: 'Times font', font: 'Times' },
//{ text: 'Symbol font', font: 'Symbol' },
//{ text: 'ZapfDingbats font', font: 'ZapfDingbats' },
],
defaultStyle: {
font: 'Helvetica'
},
language: "en-AU"
};
var now = new Date();
var pdf = pdfmake.createPdf(docDefinition);
pdf.write('pdfs/standardfonts.pdf').then(() => {
console.log(new Date() - now);
}, err => {
console.error(err);
});