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/test22.coffee

28 lines
577 B
CoffeeScript

PDFDocument = require 'pdfkit'
fs = require 'fs'
# embed otf
make = (doc) ->
# Use a font with 2048 em (noto)
doc.registerFont('fira', 'assets/fira.otf')
doc.registerFont('noto', 'assets/noto-emoji/NotoEmoji-Regular.ttf')
# Set the font, draw some text
doc.font('noto')
.fontSize(40)
.text('😂😂😂', 100, 150, {width: false})
doc.end()
doc = new PDFDocument({compress: no})
doc.pipe(fs.createWriteStream('test22.pdf'))
make doc
doc = new PDFDocument({compress: yes})
doc.pipe(fs.createWriteStream('test22c.pdf'))
make doc