diff --git a/pitfall/pitfall/kit/document.rkt b/pitfall/pitfall/kit/document.rkt index 31795b1a..41d5bd36 100644 --- a/pitfall/pitfall/kit/document.rkt +++ b/pitfall/pitfall/kit/document.rkt @@ -7,7 +7,7 @@ (define PDFDocument (class object% ; actually is an instance of readable.Stream, which is an input port - (init-field [(@options options) (mhasheq)]) + (init-field [(@options options) (mhash)]) (let ([output-file (hash-ref @options 'out "outrkt.pdf")]) (super-new)) @@ -31,9 +31,9 @@ (field [(@_offset _offset) 0]) (field [(@_root _root) (@ref - (mhasheq 'Type "Catalog" + (mhash 'Type "Catalog" 'Pages (@ref - (mhasheq 'Type "Pages" + (mhash 'Type "Pages" 'Count 0 'Kids empty))))]) @@ -54,7 +54,7 @@ #;(@initImages) ;; Initialize the metadata - (field [(@info info) (mhasheq + (field [(@info info) (mhash 'Producer "PitfallKit" 'Creator "PitfallKit" 'CreationDate (seconds->date (current-seconds)))]) @@ -189,7 +189,7 @@ (@_write "trailer") ;; todo: make `PDFObject:convert` a static method (@_write (send (make-object PDFObject) convert - (mhasheq 'Size (add1 (length @_offsets)) + (mhash 'Size (add1 (length @_offsets)) 'Root @_root 'Info @_info))) diff --git a/pitfall/pitfall/kit/reference.rkt b/pitfall/pitfall/kit/reference.rkt index 3e99487e..ce39f04a 100644 --- a/pitfall/pitfall/kit/reference.rkt +++ b/pitfall/pitfall/kit/reference.rkt @@ -4,12 +4,12 @@ (define PDFReference (class object% - (init-field [(@document document)] [(@id id)] [(@data data) (mhasheq)]) (super-new) + (init-field [(@document document)] [(@id id)] [(@data data) (mhash)]) (field [(@gen gen) 0]) (field [(@deflate deflate) #f]) - (field [(@compress compress) (and (with-handlers ([exn:fail:contract? (λ (exn) #f)]) - (get-field compress @document)) (not (hash-ref @data 'Filter #f)))]) + (field [(@compress compress) (and (· @document compress) + (not (hash-ref @data 'Filter #f)))]) (field [(@uncompressedLength uncompressedLength) 0]) (field [(@chunks chunks) empty])