handle more metadata fields

main
Matthew Butterick 5 years ago
parent d579da879a
commit 8f6b184fca

@ -49,6 +49,16 @@
(parse-1 ip) (parse-1 ip)
(port->bytes ip)) #"z")) (port->bytes ip)) #"z"))
(define excluded-keys
(list #"/Producer"
#"/Creator"
#"/CreationDate"
#"/ModDate"
#"/Keywords"
#"/Title"
#"/Author"
#"/Subject"))
(define (parse-1 ip) (define (parse-1 ip)
(cond (cond
;; the complication is that arrays & dicts can contain other arrays & dicts ;; the complication is that arrays & dicts can contain other arrays & dicts
@ -62,7 +72,7 @@
(sort ; put hash into order so it's comparable (sort ; put hash into order so it's comparable
(for/list ([kv (in-slice 2 items)] (for/list ([kv (in-slice 2 items)]
;; suppress these keys so we can compare pdfkit & pitfall output ;; suppress these keys so we can compare pdfkit & pitfall output
#:unless (member (car kv) (list #"/Producer" #"/Creator" #"/CreationDate"))) #:unless (member (car kv) excluded-keys))
(apply cons kv)) (apply cons kv))
bytes<? bytes<?
#:key car)) #:key car))

@ -32,9 +32,12 @@
;; initial values ;; initial values
(define pages null) (define pages null)
(define refs null) (define refs null)
(define info (mhasheq 'Producer "PITFALL" (define now (current-seconds))
'Creator "PITFALL" (define producer (format "Racket ~a (Pitfall library)" (version)))
'CreationDate (current-seconds))) (define info (mhasheq 'Producer producer
'Creator producer ; or application program using Pitfall
'CreationDate now
'ModDate now))
(define opacity-registry (make-hash)) (define opacity-registry (make-hash))
(define current-fill-color '("black" 1)) (define current-fill-color '("black" 1))
(define ctm default-ctm-value) (define ctm default-ctm-value)

Loading…
Cancel
Save