You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
492 B
CoffeeScript
21 lines
492 B
CoffeeScript
8 years ago
|
PDFDocument = require 'pdfkit'
|
||
|
fs = require 'fs'
|
||
|
|
||
8 years ago
|
make = (doc) ->
|
||
|
# Set the font, draw some text, and embed an image
|
||
|
doc.font('Times-Italic')
|
||
|
.fontSize(25)
|
||
8 years ago
|
.text('Some fantastic text!', 100, 100, lineBreak: no)
|
||
8 years ago
|
.image('assets/death.png', 100, 160, width: 412)
|
||
8 years ago
|
|
||
8 years ago
|
doc.end()
|
||
|
|
||
|
doc = new PDFDocument({compress: no})
|
||
|
doc.pipe(fs.createWriteStream('test5.pdf'))
|
||
|
make doc
|
||
|
|
||
8 years ago
|
doc = new PDFDocument({compress: yes})
|
||
|
doc.pipe(fs.createWriteStream('test5c.pdf'))
|
||
|
make doc
|
||
8 years ago
|
|