From 8f6b184fca750cce252215fc94117715da22ed41 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Wed, 21 Aug 2019 13:38:29 -0700 Subject: [PATCH] handle more metadata fields --- pitfall/pitfall/check-pdf.rkt | 12 +++++++++++- pitfall/pitfall/pdf.rkt | 9 ++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/pitfall/pitfall/check-pdf.rkt b/pitfall/pitfall/check-pdf.rkt index 50ed8548..795bc1fa 100644 --- a/pitfall/pitfall/check-pdf.rkt +++ b/pitfall/pitfall/check-pdf.rkt @@ -49,6 +49,16 @@ (parse-1 ip) (port->bytes ip)) #"z")) +(define excluded-keys + (list #"/Producer" + #"/Creator" + #"/CreationDate" + #"/ModDate" + #"/Keywords" + #"/Title" + #"/Author" + #"/Subject")) + (define (parse-1 ip) (cond ;; the complication is that arrays & dicts can contain other arrays & dicts @@ -62,7 +72,7 @@ (sort ; put hash into order so it's comparable (for/list ([kv (in-slice 2 items)] ;; 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)) bytes