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.
25 lines
479 B
CoffeeScript
25 lines
479 B
CoffeeScript
8 years ago
|
PDFDocument = require 'pdfkit'
|
||
|
fs = require 'fs'
|
||
|
|
||
8 years ago
|
make = (doc) ->
|
||
|
# Draw a triangle and a circle
|
||
|
doc.save()
|
||
|
.moveTo(100, 150)
|
||
|
.lineTo(100, 250)
|
||
|
.lineTo(200, 250)
|
||
|
.fill("#FF3300")
|
||
|
|
||
|
doc.circle(280, 200, 50)
|
||
|
.fill("#6600FF")
|
||
|
|
||
|
doc.end()
|
||
|
|
||
|
|
||
8 years ago
|
doc = new PDFDocument({compress: no})
|
||
|
doc.pipe(fs.createWriteStream('test1.pdf'))
|
||
8 years ago
|
make doc
|
||
8 years ago
|
|
||
8 years ago
|
doc = new PDFDocument({compress: yes})
|
||
|
doc.pipe(fs.createWriteStream('test1c.pdf'))
|
||
|
make doc
|