start test09

main
Matthew Butterick 8 years ago
parent b38a3e2378
commit 4aec7c7a3b

@ -0,0 +1,26 @@
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()
doc = new PDFDocument({compress: no})
doc.pipe(fs.createWriteStream('test09.pdf'))
make doc
doc = new PDFDocument({compress: yes})
doc.pipe(fs.createWriteStream('test09c.pdf'))
make doc

@ -0,0 +1,58 @@
%PDF-1.3
%ÿÿÿÿ
5 0 obj
<<
/Type /Page
/Parent 1 0 R
/MediaBox [0 0 612 792]
/Contents 3 0 R
/Resources 4 0 R
>>
endobj
4 0 obj
<<
/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
>>
endobj
3 0 obj
<<
/Length 179
>>
stream
1 0 0 -1 0 792 cm
0 20 m
100 160 l
130 200 150 120 v
190 -40 200 200 300 150 c
400 90 l
S
1 0 0 1 0 200 cm
0 20 m
100 160 l
130 200 150 120 v
190 -40 200 200 300 150 c
400 90 l
S
endstream
endobj
6 0 obj
<<
/Producer (PDFKit)
/Creator (PDFKit)
/CreationDate (D:20170523041028Z)
>>
endobj
2 0 obj
<<
/Type /Catalog
/Pages 1 0 R
>>
endobj
1 0 obj
<<
/Type /Pages
/Count 1
/Kids [5 0 R]
>>
endobj

@ -0,0 +1,22 @@
#lang pitfall/pdftest
(define (proc doc)
(send* doc
[moveTo 0 20]
[lineTo 100 160]
[quadraticCurveTo 130 200 150 120]
[bezierCurveTo 190 -40 200 200 300 150]
[lineTo 400 90]
[stroke])
(send* doc [translate 0 200])
(send* doc
[path "M 0,20 L 100,160 Q 130,200 150,120 C 190,-40 200,200 300,150 L 400,90"]
[stroke]))
(define-runtime-path this "test09rkt.pdf")
(make-doc this #f proc #:test #f) ; node's zlib.deflate makes smaller files, for some reason
(define-runtime-path that "test09crkt.pdf")
(make-doc that #t proc #:test #f)

@ -0,0 +1,64 @@
%PDF-1.3
%ÿÿÿÿ
5 0 obj
<<
/Type /Page
/Parent 1 0 R
/MediaBox [0 0 612 792]
/Contents 3 0 R
/Resources 4 0 R
>>
endobj
4 0 obj
<<
/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
>>
endobj
6 0 obj
<<
/Producer (PDFKit)
/Creator (PDFKit)
/CreationDate (D:20170523041028Z)
>>
endobj
2 0 obj
<<
/Type /Catalog
/Pages 1 0 R
>>
endobj
1 0 obj
<<
/Type /Pages
/Count 1
/Kids [5 0 R]
>>
endobj
3 0 obj
<<
/Length 81
/Filter /FlateDecode
>>
stream
­LA€0 ºó
>`R¶©Ù;|®îêû¥êLi¡ †giï…c"XŠ ¶à Õ”|­†½ ꎴWMÔÏhÞz†èiNΗoL Ð
endstream
endobj
xref
0 7
0000000000 65535 f
0000000327 00000 n
0000000278 00000 n
0000000384 00000 n
0000000119 00000 n
0000000015 00000 n
0000000186 00000 n
trailer
<<
/Size 7
/Root 2 0 R
/Info 6 0 R
>>
startxref
536
%%EOF

@ -14,7 +14,7 @@ doc = new PDFDocument({compress: no})
doc.pipe(fs.createWriteStream('test8.pdf'))
make doc
#doc = new PDFDocument({compress: yes})
#doc.pipe(fs.createWriteStream('test8c.pdf'))
#make doc
doc = new PDFDocument({compress: yes})
doc.pipe(fs.createWriteStream('test8c.pdf'))
make doc

Loading…
Cancel
Save