correct header generation

main
Matthew Butterick 5 years ago
parent 5736cc2e28
commit dedbd5be3e

@ -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))

@ -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)))))

Loading…
Cancel
Save