diff --git a/pitfall/pitfall/document.rkt b/pitfall/pitfall/document.rkt index 499d44fe..233ec08b 100644 --- a/pitfall/pitfall/document.rkt +++ b/pitfall/pitfall/document.rkt @@ -47,6 +47,7 @@ (inherit-field @ctm) ; from vector mixin (inherit-field @font-families) (inherit font) ; from font mixin (inherit-field [@x x] [@y y]) ; from text + (inherit transform) ; from vector (inherit-field @pages) (inherit page) ; from base ;; initialize params @@ -59,6 +60,10 @@ (for ([(key val) (in-hash (hash-ref @options 'info (hasheq)))]) (hash-set! @info key val)) + ;; write the header now, before any other subroutine starts up + (write-bytes-out (format "%PDF-~a" (current-pdf-version))) + (write-bytes-out "%ÿÿÿÿ") + (define/public (store-ref ref) (set! @refs (cons ref @refs))) @@ -73,13 +78,10 @@ ;; flip PDF coordinate system so that the origin is in ;; the top left rather than the bottom left (set! @ctm default-ctm-value) - (send this transform 1 0 0 -1 0 (get-field height (page))) + (transform 1 0 0 -1 0 (get-field height (page))) this) (define/public (end) - (write-bytes-out (format "%PDF-~a" (current-pdf-version))) - (write-bytes-out "%ÿÿÿÿ") - (for ([page (in-list @pages)]) (send page end)) diff --git a/pitfall/pitfall/pdftest.rkt b/pitfall/pitfall/pdftest.rkt index 220dded7..c691678f 100644 --- a/pitfall/pitfall/pdftest.rkt +++ b/pitfall/pitfall/pdftest.rkt @@ -42,8 +42,8 @@ (send doc end)) #:exists 'replace)) (when test? - #;(check-headers-equal? ps (this->control ps)) + (check-headers-equal? ps (this->control ps)) (check-pdfs-equal? ps (this->control ps)) (when pdfkit? - #;(check-headers-equal? ps (this->pdfkit-control ps)) + (check-headers-equal? ps (this->pdfkit-control ps)) (check-pdfs-equal? ps (this->pdfkit-control ps)))))