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.
27 lines
698 B
CoffeeScript
27 lines
698 B
CoffeeScript
8 years ago
|
PDFDocument = require 'pdfkit'
|
||
|
fs = require 'fs'
|
||
|
|
||
|
make = (doc) ->
|
||
|
doc.moveTo(0, 20)
|
||
|
.lineTo(100, 160)
|
||
|
.quadraticCurveTo(130, 200, 150, 120)
|
||
|
.bezierCurveTo(190, -40, 200, 200, 300, 150) # draw a bezier curve
|
||
|
.lineTo(400, 90) # draw another line
|
||
|
.stroke() # stroke the path
|
||
|
|
||
|
doc.translate(0, 200)
|
||
|
|
||
|
doc.path('M 0,20 L 100,160 Q 130,200 150,120 C 190,-40 200,200 300,150 L 400,90')
|
||
|
.stroke()
|
||
|
|
||
|
doc.end()
|
||
|
|
||
6 years ago
|
doc = new PDFDocument({compress: no})
|
||
|
doc.pipe(fs.createWriteStream('test9.pdf'))
|
||
|
make doc
|
||
|
|
||
8 years ago
|
doc = new PDFDocument({compress: yes})
|
||
6 years ago
|
doc.pipe(fs.createWriteStream('test9c.pdf'))
|
||
|
make doc
|
||
|
|