From 4aec7c7a3b7a3aabd155241c4238ebfcd4f683be Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Mon, 22 May 2017 18:13:26 -1000 Subject: [PATCH] start test09 --- pitfall/pitfall/test/test09.coffee | 26 ++++++++++++ pitfall/pitfall/test/test09.pdf | 58 +++++++++++++++++++++++++++ pitfall/pitfall/test/test09.rkt | 22 ++++++++++ pitfall/pitfall/test/test09c.pdf | 64 ++++++++++++++++++++++++++++++ pitfall/pitfall/test/test09rkt.pdf | 0 pitfall/pitfall/test/test8.coffee | 6 +-- 6 files changed, 173 insertions(+), 3 deletions(-) create mode 100644 pitfall/pitfall/test/test09.coffee create mode 100644 pitfall/pitfall/test/test09.pdf create mode 100644 pitfall/pitfall/test/test09.rkt create mode 100644 pitfall/pitfall/test/test09c.pdf create mode 100644 pitfall/pitfall/test/test09rkt.pdf diff --git a/pitfall/pitfall/test/test09.coffee b/pitfall/pitfall/test/test09.coffee new file mode 100644 index 00000000..05837cb4 --- /dev/null +++ b/pitfall/pitfall/test/test09.coffee @@ -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 \ No newline at end of file diff --git a/pitfall/pitfall/test/test09.pdf b/pitfall/pitfall/test/test09.pdf new file mode 100644 index 00000000..15798190 --- /dev/null +++ b/pitfall/pitfall/test/test09.pdf @@ -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 diff --git a/pitfall/pitfall/test/test09.rkt b/pitfall/pitfall/test/test09.rkt new file mode 100644 index 00000000..e3d7d5fc --- /dev/null +++ b/pitfall/pitfall/test/test09.rkt @@ -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) diff --git a/pitfall/pitfall/test/test09c.pdf b/pitfall/pitfall/test/test09c.pdf new file mode 100644 index 00000000..ecdee311 --- /dev/null +++ b/pitfall/pitfall/test/test09c.pdf @@ -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 +xœ­LA€0 ºó +>`R¶©Ù;|®îêû¥êLi¡ †g‘iï…c"X‚Š ¶à Õ”|­†½ ꎴWMÔÏhÞz†èiNΗ‹o‹L Ð +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 diff --git a/pitfall/pitfall/test/test09rkt.pdf b/pitfall/pitfall/test/test09rkt.pdf new file mode 100644 index 00000000..e69de29b diff --git a/pitfall/pitfall/test/test8.coffee b/pitfall/pitfall/test/test8.coffee index cedb6cb1..3f435eb2 100644 --- a/pitfall/pitfall/test/test8.coffee +++ b/pitfall/pitfall/test/test8.coffee @@ -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