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.
typesetting/pitfall/ptest/test14.coffee

24 lines
502 B
CoffeeScript

8 years ago
PDFDocument = require 'pdfkit'
fs = require 'fs'
make = (doc) ->
# Register a font name for use later
8 years ago
doc.registerFont('the-font', 'assets/fira.ttf')
8 years ago
# Set the font, draw some text
doc.font('the-font')
.fontSize(25)
8 years ago
.text('Hola Hola', 100, 100, {width: false})
8 years ago
doc.end()
doc = new PDFDocument({compress: no})
doc.pipe(fs.createWriteStream('test14.pdf'))
make doc
6 years ago
doc = new PDFDocument({compress: yes})
doc.pipe(fs.createWriteStream('test14c.pdf'))
make doc