diff --git a/pitfall/pitfall/minimal-annotation.rkt b/pitfall/pitfall/minimal-annotation-square.rkt similarity index 100% rename from pitfall/pitfall/minimal-annotation.rkt rename to pitfall/pitfall/minimal-annotation-square.rkt diff --git a/pitfall/pitfall/minimal-annotation-text.rkt b/pitfall/pitfall/minimal-annotation-text.rkt new file mode 100644 index 00000000..6eecdaa5 --- /dev/null +++ b/pitfall/pitfall/minimal-annotation-text.rkt @@ -0,0 +1,63 @@ +#lang at-exp s-exp pitfall/render + +;; catalog object +(co-io 1 0 (co-catalog #:pages (co-io-ref 2 0))) + +;; pages +(co-io 2 0 (co-pages #:kids (list (co-io-ref 3 0)) + #:count 1)) +;; page +(co-io 3 0 (co-page #:parent (co-io-ref 2 0) + #:mediabox '(0 0 400 400) + #:resources (co-io-ref 4 0) + #:contents (co-io-ref 5 0) + + ; the value of annots must be an array + #:annots (co-array (list (co-io-ref 7 0))) + )) +#;#:annots (co-io-ref 7 0) + +;; resources +(co-io 4 0 + (make-co-dict + 'ProcSet (co-array '(PDF Text)) + 'Font (make-co-dict 'F1 (co-io-ref 6 0)))) + +;; contents +(co-io 5 0 + (make-co-stream + #" +BT +/F1 24 Tf +1 0 0 1 100 100 Tm +1 0 0 RG +[2] 0 d +0.75 g +2 Tr +(Hello) Tj +2 0 0 2 160 100 Tm +0 0 0 RG +0 g +(World) Tj +ET +")) + + +;; font +(co-io 6 0 + (make-co-dict + 'Type 'Font 'Subtype 'Type1 'Name 'F1 'BaseFont 'Helvetica)) + + + +(co-io 7 0 + (make-co-dict 'Type 'Annot + 'Subtype 'Link + 'Rect (co-array '(100 100 150 125)) + 'A (co-io-ref 8 0))) + + +(co-io 8 0 + (make-co-dict 'Type 'Action + 'S 'URI + 'URI (co-string "http://practicaltypography.com"))) \ No newline at end of file diff --git a/pitfall/pitfall/render.rkt b/pitfall/pitfall/render.rkt index f7aff82a..914d7cb5 100644 --- a/pitfall/pitfall/render.rkt +++ b/pitfall/pitfall/render.rkt @@ -34,7 +34,7 @@ (if (co-io? cosexpr) (cons (cons (co-io-idx cosexpr) offset) io-locs) io-locs)))) - (define header-str (cosexpr->bytes (co-header "%PDF-1.4\n%¥±ë"))) + (define header-str (cosexpr->bytes (co-header "%PDF-1.3\n%¥±ë"))) (define trailer-str (cosexpr->bytes (co-trailer (co-dict (hasheq 'Size (length bstrs) 'Root (co-io-ref 1 0)))))) (define last-offset (for/sum ([bstr (in-list bstrs)])