You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2021. It is now read-only.
// Set the font, draw some text, and embed an image
19
+
doc.font('Palatino').fontSize(25).text('Some text with an embedded font!',100,100).fontSize(18).text('PNG and JPEG images:').image('images/test.png',100,160,{
20
+
width: 412
21
+
}).image('images/test.jpeg',190,400,{
22
+
height: 300
23
+
});
24
+
25
+
// Add another page
26
+
doc.addPage().fontSize(25).text('Here is some vector graphics...',100,100);
doc.scale(0.6).translate(470,-380).path('M 250,75 L 323,301 131,161 369,161 177,301 z').fill('red','even-odd').restore();// render an SVG path // fill using the even-odd winding rule
34
+
35
+
varloremIpsum='Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam in suscipit purus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Vivamus nec hendrerit felis. Morbi aliquam facilisis risus eu lacinia. Sed eu leo in turpis fringilla hendrerit. Ut nec accumsan nisl. Suspendisse rhoncus nisl posuere tortor tempus et dapibus elit porta. Cras leo neque, elementum a rhoncus ut, vestibulum non nibh. Phasellus pretium justo turpis. Etiam vulputate, odio vitae tincidunt ultricies, eros odio dapibus nisi, ut tincidunt lacus arcu eu elit. Aenean velit erat, vehicula eget lacinia ut, dignissim non tellus. Aliquam nec lacus mi, sed vestibulum nunc. Suspendisse potenti. Curabitur vitae sem turpis. Vestibulum sed neque eget dolor dapibus porttitor at sit amet sem. Fusce a turpis lorem. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;\nMauris at ante tellus. Vestibulum a metus lectus. Praesent tempor purus a lacus blandit eget gravida ante hendrerit. Cras et eros metus. Sed commodo malesuada eros, vitae interdum augue semper quis. Fusce id magna nunc. Curabitur sollicitudin placerat semper. Cras et mi neque, a dignissim risus. Nulla venenatis porta lacus, vel rhoncus lectus tempor vitae. Duis sagittis venenatis rutrum. Curabitur tempor massa tortor.';
36
+
37
+
// Draw some text wrapped to 412 points wide
38
+
doc.text('And here is some wrapped text...',100,300).font('Helvetica',13).moveDown().text(loremIpsum,{// move down 1 line
39
+
width: 412,
40
+
align: 'justify',
41
+
indent: 30,
42
+
paragraphGap: 5
43
+
});
44
+
45
+
// Add another page, and set the font back
46
+
doc.addPage().font('Palatino',25).text('Rendering some SVG paths...',100,100).translate(220,300);
47
+
48
+
vari,len,part;
49
+
// Render each path that makes up the tiger image
50
+
for(i=0,len=tiger.length;i<len;i++){
51
+
part=tiger[i];
52
+
doc.save();
53
+
doc.path(part.path);// render an SVG path
54
+
if(part['stroke-width']){
55
+
doc.lineWidth(part['stroke-width']);
56
+
}
57
+
if(part.fill!=='none'&&part.stroke!=='none'){
58
+
doc.fillAndStroke(part.fill,part.stroke);
59
+
}else{
60
+
if(part.fill!=='none'){
61
+
doc.fill(part.fill);
62
+
}
63
+
if(part.stroke!=='none'){
64
+
doc.stroke(part.stroke);
65
+
}
66
+
}
67
+
doc.restore();
68
+
}
69
+
70
+
// Add some text with annotations
71
+
doc.addPage().fillColor("blue").text('Here is a link!',100,100,{
72
+
link: 'http://google.com/',
73
+
underline: true
74
+
});
75
+
76
+
77
+
// Add a list with a font loaded from a TrueType collection file
0 commit comments