diff --git a/pitfall/pitfall/annotations.rkt b/pitfall/pitfall/annotations.rkt index 90212221..71e6c0d5 100644 --- a/pitfall/pitfall/annotations.rkt +++ b/pitfall/pitfall/annotations.rkt @@ -36,7 +36,7 @@ (for ([(k v) (in-hash options)]) (hash-set! options (string->symbol (string-titlecase (symbol->string k))) v)) - (define annots-ref (send this ref options)) + (define annots-ref (send this make-ref options)) (send (· this page) annotations annots-ref) (· annots-ref end) this) @@ -46,7 +46,7 @@ ((number? number? number? number? string?) (hash?) . ->*m . object?) (hash-set*! options 'Subtype "Link" - 'A (send this ref (mhash 'S "URI" + 'A (send this make-ref (mhash 'S "URI" 'URI (String url)))) (send (· options A) end) (send this annotate x y w h options)) diff --git a/pitfall/pitfall/color.rkt b/pitfall/pitfall/color.rkt index 6aef5974..aa7d499f 100644 --- a/pitfall/pitfall/color.rkt +++ b/pitfall/pitfall/color.rkt @@ -104,7 +104,7 @@ (hash-set! dictionary 'ca fill-opacity)) (when stroke-opacity (hash-set! dictionary 'CA stroke-opacity)) - (define ref-dict (send this ref dictionary)) + (define ref-dict (send this make-ref dictionary)) (send ref-dict end) (set! @opacity-count (add1 @opacity-count)) (list ref-dict (format "Gs~a" @opacity-count))))) diff --git a/pitfall/pitfall/document.rkt b/pitfall/pitfall/document.rkt index 20c9c110..184fd27f 100644 --- a/pitfall/pitfall/document.rkt +++ b/pitfall/pitfall/document.rkt @@ -28,8 +28,8 @@ [@ref-gen (generator () (let loop ([refid 1]) (yield refid) (loop (add1 refid))))] - [@root (ref (mhasheq 'Type "Catalog" - 'Pages (ref (mhasheq 'Type "Pages"))))] + [@root (make-ref (mhasheq 'Type "Catalog" + 'Pages (make-ref (mhasheq 'Type "Pages"))))] [(@x x) 0] [(@y y) 0] ;; initialize the metadata @@ -55,7 +55,7 @@ (define/public (page) (first @pages)) - (define/public (ref [payload (mhasheq)]) + (define/public (make-ref [payload (mhasheq)]) (define new-ref (make-object PDFReference (@ref-gen) payload)) (set! @refs (cons new-ref @refs)) new-ref) @@ -85,7 +85,7 @@ (for ([page (in-list @pages)]) (send page end)) - (define doc-info (ref)) + (define doc-info (make-ref)) (for ([(key val) (in-hash @info)]) (dict-set! doc-info key (if (string? val) (String val) val))) (send doc-info end) diff --git a/pitfall/pitfall/embedded.rkt b/pitfall/pitfall/embedded.rkt index e5cf6705..ddc2055d 100644 --- a/pitfall/pitfall/embedded.rkt +++ b/pitfall/pitfall/embedded.rkt @@ -88,7 +88,7 @@ https://github.com/mbutterick/pdfkit/blob/master/lib/font/embedded.coffee (define/override (embed) ;; no CFF support (define isCFF #false) #;(is-a? subset CFFSubset) - (define font-file (send @document ref)) + (define font-file (send @document make-ref)) (when isCFF (dict-set! font-file 'Subtype "CIDFontType0C")) @@ -115,7 +115,7 @@ https://github.com/mbutterick/pdfkit/blob/master/lib/font/embedded.coffee (integer->char (random 65 (+ 65 26)))))) (define name (string-append tag "+" (font-postscript-name font))) (define bbox (font-bbox font)) - (define descriptor (send @document ref + (define descriptor (send @document make-ref (mhash 'Type "FontDescriptor" 'FontName name @@ -132,7 +132,7 @@ https://github.com/mbutterick/pdfkit/blob/master/lib/font/embedded.coffee (dict-set! descriptor (if isCFF 'FontFile3 'FontFile2) font-file) (send descriptor end) - (define descendant-font (send @document ref + (define descendant-font (send @document make-ref (mhash 'Type "Font" 'Subtype (string-append "CIDFontType" (if isCFF "0" "2")) @@ -159,7 +159,7 @@ https://github.com/mbutterick/pdfkit/blob/master/lib/font/embedded.coffee (define/public (toUnicodeCmap) - (define cmap (send @document ref)) + (define cmap (send @document make-ref)) (define entries (for/list ([idx (in-range (length (hash-keys unicode)))]) (define codepoints (hash-ref unicode idx)) diff --git a/pitfall/pitfall/font.rkt b/pitfall/pitfall/font.rkt index 199aa573..6531be7f 100644 --- a/pitfall/pitfall/font.rkt +++ b/pitfall/pitfall/font.rkt @@ -17,7 +17,7 @@ (define/public (ref) (unless @dictionary - (set! @dictionary (send @document ref))) + (set! @dictionary (send @document make-ref))) @dictionary) (define/public (finalize) diff --git a/pitfall/pitfall/jpeg-structy.rkt b/pitfall/pitfall/jpeg-structy.rkt index 97251354..cabd5b93 100644 --- a/pitfall/pitfall/jpeg-structy.rkt +++ b/pitfall/pitfall/jpeg-structy.rkt @@ -48,7 +48,7 @@ (unless (· this obj) (set-field! obj this - (send doc-in ref + (send doc-in make-ref (mhash 'Type "XObject" 'Subtype "Image" diff --git a/pitfall/pitfall/jpeg.rkt b/pitfall/pitfall/jpeg.rkt index beab92ec..c7ffe86f 100644 --- a/pitfall/pitfall/jpeg.rkt +++ b/pitfall/pitfall/jpeg.rkt @@ -55,7 +55,7 @@ (unless (· this obj) (set-field! obj this - (send doc-in ref + (send doc-in make-ref (mhash 'Type "XObject" 'Subtype "Image" diff --git a/pitfall/pitfall/page.rkt b/pitfall/pitfall/page.rkt index df995d80..1da9c30b 100644 --- a/pitfall/pitfall/page.rkt +++ b/pitfall/pitfall/page.rkt @@ -18,8 +18,8 @@ (hash-ref page-sizes (string-upcase @size)))] [(@width width) (list-ref @dimensions (if (equal? @layout "portrait") 0 1))] [(@height height) (list-ref @dimensions (if (equal? @layout "portrait") 1 0))] - [@content (send @doc ref)] - [(@resources resources) (send @doc ref (mhash 'ProcSet '("PDF" "Text" "ImageB" "ImageC" "ImageI")))] + [@content (send @doc make-ref)] + [(@resources resources) (send @doc make-ref (mhash 'ProcSet '("PDF" "Text" "ImageB" "ImageC" "ImageI")))] [(@margins margins) (let ([margin-value (hash-ref @options 'margin #f)]) (if (number? margin-value) @@ -27,7 +27,7 @@ (hash-ref @options 'margins (current-default-margins))))] ;; The page dictionary [(@dictionary dictionary) - (send @doc ref + (send @doc make-ref (mhash 'Type "Page" 'Parent @page-parent 'MediaBox (list 0 0 @width @height) diff --git a/pitfall/pitfall/png.rkt b/pitfall/pitfall/png.rkt index 1e9791b2..0f0b7102 100644 --- a/pitfall/pitfall/png.rkt +++ b/pitfall/pitfall/png.rkt @@ -34,7 +34,7 @@ (unless (· this obj) (set-field! obj this - (send (· this document) ref + (send (· this document) make-ref (mhash 'Type "XObject" 'Subtype "Image" 'BitsPerComponent (· this image bits) @@ -43,7 +43,7 @@ 'Filter "FlateDecode"))) (unless (· this image hasAlphaChannel) - (define params (send (· this document) ref + (define params (send (· this document) make-ref (mhash 'Predictor 15 'Colors (· this image colors) 'BitsPerComponent (· this image bits) @@ -82,7 +82,7 @@ (when (· this alphaChannel) (define sMask - (send (· this document) ref + (send (· this document) make-ref (mhash 'Type "XObject" 'Subtype "Image" 'Height (· this height)