resume in annot rect width and append annots to dict

main
Matthew Butterick 7 years ago
parent 7dba1d4c71
commit 90015665e2

@ -16,9 +16,9 @@
'Type "Annot"
'Rect (send this _convertRect x y w h)
'Border '(0 0 0))
(hash-ref! options 'C
(λ ()
(unless (equal? (· options Subtype) "Link")
(unless (equal? (· options Subtype) "Link")
(hash-ref! options 'C
(λ ()
(send this _normalizeColor (or (· options color) '(0 0 0))))))
(hash-remove! options 'color)
@ -28,8 +28,9 @@
(for ([(k v) (in-hash options)])
(hash-set! options (string->symbol (string-titlecase (symbol->string k))) v))
(define ref (· this ref options))
(push-field! annotations this ref)
(define ref (send this ref options))
(send (· this page) annotations ref)
(· ref end)
this)

@ -61,9 +61,11 @@
(->m hash?)
(hash-ref! (· this resources payload) 'Pattern (make-hash)))
(define/contract (annotations this)
(->m hash?)
(hash-ref! (· this resources payload) 'Annots null))
(define/contract (annotations this [annot #f])
(() (any/c) . ->*m . void?)
(if (not annot)
(hash-ref! (· this resources payload) 'Annots null)
(hash-update! (· this resources payload) 'Annots (λ (val) (cons annot val)) null)))
(define/contract (maxY this)

@ -0,0 +1,113 @@
%PDF-1.3
%ÿÿÿÿ
6 0 obj
<<
/ca 1
/Type /ExtGState
>>
endobj
7 0 obj
<<
/URI (http://google.com/)
/S /URI
>>
endobj
8 0 obj
<<
/A 7 0 R
/Border [0 0 0]
/Subtype /Link
/Rect [100 664.25 100 692]
/Type /Annot
>>
endobj
9 0 obj
<<
/CA 1
/Type /ExtGState
>>
endobj
5 0 obj
<<
/Parent 1 0 R
/Resources 4 0 R
/Contents 3 0 R
/MediaBox [0 0 612 792]
/Type /Page
>>
endobj
4 0 obj
<<
/Annots [8 0 R]
/Font <<
/F1 10 0 R
>>
/ExtGState <<
/Gs2 9 0 R
/Gs1 6 0 R
>>
/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
>>
endobj
3 0 obj
<<
/Length 153
/Filter /FlateDecode
>>
stream
xœeŽÁ
Â0 †ïyŠ¼€[Óµ©ñ°©¶7ñ²REp|~SØa !?äÏþ¸Vcœ Þ¥ï3¦ËÐaÌP¶„9¾¡2á#ÃgIô~&|*„.)q´©œÅi9¼ÀÃYîé/³ ³IXxvª2ŒAž96
î³fë4[­¸u<C2B8>(IGn9ñ¨iê†áû ?J<>
endstream
endobj
11 0 obj
<<
/CreationDate (D:19700101000000Z)
/Creator (PITKIT)
/Producer (PITKIT)
>>
endobj
10 0 obj
<<
/BaseFont /Helvetica
/Encoding /WinAnsiEncoding
/Subtype /Type1
/Type /Font
>>
endobj
2 0 obj
<<
/Pages 1 0 R
/Type /Catalog
>>
endobj
1 0 obj
<<
/Kids [5 0 R]
/Count 1
/Type /Pages
>>
endobj
xref
0 12
0000000000 65535 f
0000000973 00000 n
0000000924 00000 n
0000000508 00000 n
0000000363 00000 n
0000000259 00000 n
0000000015 00000 n
0000000059 00000 n
0000000114 00000 n
0000000215 00000 n
0000000826 00000 n
0000000733 00000 n
trailer
<<
/Info 11 0 R
/Root 2 0 R
/Size 12
>>
startxref
1030
%%EOF

@ -0,0 +1,83 @@
%PDF-1.3
%ÿÿÿÿ
5 0 obj
<<
/Parent 1 0 R
/Resources 4 0 R
/Contents 3 0 R
/MediaBox [0 0 612 792]
/Type /Page
>>
endobj
4 0 obj
<<
/Font <<
/F1 6 0 R
>>
/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
>>
endobj
3 0 obj
<<
/Length 123
>>
stream
1 0 0 -1 0 792 cm
q
1 0 0 -1 0 792 cm
BT
1 0 0 1 72 711.384 Tm
/F1 12 Tf
[<48656c6c6f2077> 10 <6f72> -15 <6c64> 0] TJ
ET
Q
endstream
endobj
7 0 obj
<<
/CreationDate (D:19700101000000Z)
/Creator (PITKIT)
/Producer (PITKIT)
>>
endobj
6 0 obj
<<
/BaseFont /Helvetica
/Encoding /WinAnsiEncoding
/Subtype /Type1
/Type /Font
>>
endobj
2 0 obj
<<
/Pages 1 0 R
/Type /Catalog
>>
endobj
1 0 obj
<<
/Kids [5 0 R]
/Count 1
/Type /Pages
>>
endobj
xref
0 8
0000000000 65535 f
0000000620 00000 n
0000000571 00000 n
0000000208 00000 n
0000000119 00000 n
0000000015 00000 n
0000000474 00000 n
0000000382 00000 n
trailer
<<
/Info 7 0 R
/Root 2 0 R
/Size 8
>>
startxref
677
%%EOF

@ -125,26 +125,25 @@
;; create link annotations if the link option is given
(when (· options link)
(report 'zing)
(send this link x y-in renderedWidth (· this currentLineHeight) (hash-ref options 'link)))
(error 'froom)
(send this link x y-in renderedWidth (· this currentLineHeight) (· options link)))
;; create underline or strikethrough line
(when (or (· options underline) (· options strike))
(send this save)
(unless (· options stroke)
(send this strokeColor (· this _fillColor)))
(define args (· this _fillColor))
(send this strokeColor . args))
(define lineWidth (if (< (· this _fontSize) 10)
0.5
(floor (/ (· this _fontSize) 10) 10)))
(floor (/ (· this _fontSize) 10))))
(define d (if (· options underline) 1 2))
(define lineY (+ y (/ (· this currentLineHeight) d)))
(define lineY (+ y-in (/ (· this currentLineHeight) d)))
(when (· options underline)
(increment! lineY (- lineWidth)))
(send this moveTo x lineY)
(send this lineTo (+ x renderedWidth lineY))
(send this lineTo (+ x renderedWidth) lineY)
(send this stroke)
(send this restore))

Loading…
Cancel
Save