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.
72 lines
1.6 KiB
CoffeeScript
72 lines
1.6 KiB
CoffeeScript
PDFDocument = require 'pdfkit'
|
|
fs = require 'fs'
|
|
|
|
make = (doc) ->
|
|
doc.font("Courier-Bold")
|
|
.fontSize(10)
|
|
.text("Hello", lineBreak: no)
|
|
.translate(-30,30)
|
|
.font("Courier-BoldOblique")
|
|
.fontSize(11)
|
|
.text("Hello", lineBreak: no)
|
|
.translate(-30,30)
|
|
.font("Courier-Oblique")
|
|
.fontSize(12)
|
|
.text("Hello", lineBreak: no)
|
|
.translate(-30,30)
|
|
.font("Courier")
|
|
.fontSize(14)
|
|
.text("Hello", lineBreak: no)
|
|
.translate(-30,30)
|
|
.font("Helvetica-Bold")
|
|
.fontSize(16)
|
|
.text("Hello", lineBreak: no)
|
|
.translate(-30,30)
|
|
.font("Helvetica-BoldOblique")
|
|
.fontSize(18)
|
|
.text("Hello", lineBreak: no)
|
|
.translate(-30,30)
|
|
.font("Helvetica-Oblique")
|
|
.fontSize(20)
|
|
.text("Hello", lineBreak: no)
|
|
.translate(-30,30)
|
|
.font("Helvetica")
|
|
.fontSize(22)
|
|
.text("Hello", lineBreak: no)
|
|
.translate(-30,30)
|
|
.font("Symbol")
|
|
.fontSize(24)
|
|
.text("Hello", lineBreak: no)
|
|
.translate(-30,30)
|
|
.font("Times-Bold")
|
|
.fontSize(26)
|
|
.text("Hello", lineBreak: no)
|
|
.translate(-30,30)
|
|
.font("Times-BoldItalic")
|
|
.fontSize(28)
|
|
.text("Hello", lineBreak: no)
|
|
.translate(-30,30)
|
|
.font("Times-Italic")
|
|
.fontSize(30)
|
|
.text("Hello", lineBreak: no)
|
|
.translate(-30,30)
|
|
.font("Times-Roman")
|
|
.fontSize(32)
|
|
.text("Hello", lineBreak: no)
|
|
.translate(-30,30)
|
|
.font("ZapfDingbats")
|
|
.fontSize(34)
|
|
.text("Hello", lineBreak: no)
|
|
|
|
doc.end()
|
|
|
|
|
|
doc = new PDFDocument({compress: no})
|
|
doc.pipe(fs.createWriteStream('test4.pdf'))
|
|
make doc
|
|
|
|
doc = new PDFDocument({compress: yes})
|
|
doc.pipe(fs.createWriteStream('test4c.pdf'))
|
|
make doc
|
|
|