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.
24 lines
528 B
CoffeeScript
24 lines
528 B
CoffeeScript
8 years ago
|
PDFDocument = require 'pdfkit'
|
||
|
fs = require 'fs'
|
||
|
|
||
|
make = (doc) ->
|
||
|
|
||
|
# Register a font name for use later
|
||
|
doc.registerFont('Charter', 'assets/charter.ttf')
|
||
|
|
||
|
# Set the font, draw some text
|
||
|
doc.font('Charter')
|
||
|
.fontSize(25)
|
||
|
.text('Some text with an embedded font', 100, 100, {width: false})
|
||
|
|
||
|
doc.end()
|
||
|
|
||
|
|
||
|
doc = new PDFDocument({compress: no})
|
||
|
doc.pipe(fs.createWriteStream('test12.pdf'))
|
||
|
make doc
|
||
|
|
||
8 years ago
|
#doc = new PDFDocument({compress: yes})
|
||
|
#doc.pipe(fs.createWriteStream('test12c.pdf'))
|
||
|
#make doc
|