start-doc and end-doc

main
Matthew Butterick 5 years ago
parent dedbd5be3e
commit 00e0470114

@ -60,10 +60,6 @@
(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)))
@ -81,7 +77,11 @@
(transform 1 0 0 -1 0 (get-field height (page)))
this)
(define/public (end)
(define/public (start-doc)
(write-bytes-out (format "%PDF-~a" (current-pdf-version)))
(write-bytes-out "%ÿÿÿÿ"))
(define/public (end-doc)
(for ([page (in-list @pages)])
(send page end))

@ -38,8 +38,9 @@
(with-output-to-file ps
(λ ()
(define doc (make-object PDFDocument (hash 'compress compress?)))
(send doc start-doc)
(proc doc)
(send doc end))
(send doc end-doc))
#:exists 'replace))
(when test?
(check-headers-equal? ps (this->control ps))

Loading…
Cancel
Save