blank page victory

main
Matthew Butterick 8 years ago
parent 811a58c961
commit 0158b3af79

@ -1,20 +1,57 @@
%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
<<
/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
>>
endobj
3 0 obj
<<
/Length 18
>>
stream
1 0 0 -1 0 792 cm
endstream
endobj
6 0 obj
<<
/Producer (PitfallKit)
/CreationDate 0
/Creator (PitfallKit)
>>
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 7
0000000000 65535 f
0000057005 00000 n
0000057005 00000 n
0000057005 00000 n
0000057005 00000 n
0000057005 00000 n
0000057005 00000 n
0000000385 00000 n
0000000336 00000 n
0000000186 00000 n
0000000119 00000 n
0000000015 00000 n
0000000254 00000 n
trailer
<<
/Info 6 0 R
@ -22,5 +59,5 @@ trailer
/Size 7
>>
startxref
63
442
%%EOF

@ -56,9 +56,9 @@
;; Initialize the metadata
(field [(@info info) (mhash
'Producer "PDFKit"
'Creator "PDFKit"
'CreationDate (seconds->date (current-seconds)))])
'Producer "PitfallKit"
'Creator "PitfallKit"
'CreationDate #;(seconds->date (current-seconds)) 0)]) ; debug val
(when (hash-ref @options 'info #f)
(for ([(key val) (in-hash (hash-ref @options 'info))])
@ -133,7 +133,7 @@
(public [@ref ref])
(define (@ref [data (make-hasheq)])
(define ref (make-object PDFReference this (add1 (length @_offsets)) data))
(push-end @_offsets (* 1000 (add1 (length @_offsets)))) ; placeholder for this object's offset once it is finalized
(push-end @_offsets #f) ; placeholder for this object's offset once it is finalized
(++ @_waiting)
ref)
@ -155,12 +155,10 @@
this)
(define/public (_refEnd ref)
(report* @_offsets (· ref id) (· ref offset))
(set! @_offsets (for/list ([(offset idx) (in-indexed @_offsets)])
(if (= (sub1 (· ref id)) idx)
(if (= (· ref id) (add1 idx))
(· ref offset)
offset)))
(report* @_offsets)
(-- @_waiting)
(if (and (zero? @_waiting) @_ended)
(@_finalize)
@ -201,7 +199,7 @@
(@_write "0000000000 65535 f ")
(for ([offset (in-list @_offsets)])
(@_write (string-append
(~r (or offset #xdead) #;debug #:min-width 10 #:pad-string "0")
(~r offset #:min-width 10 #:pad-string "0")
" 00000 n ")))
;; trailer
(@_write "trailer")
@ -229,7 +227,7 @@
(require rackunit racket/file)
(define ob (open-output-bytes))
(send doc pipe ob)
(send doc pipe (open-output-file "zzz.pdf" #:exists 'replace))
#;(send doc pipe (open-output-file "demo.pdf" #:exists 'replace))
(check-equal? (send doc end) 'done)
#;(display (get-output-bytes ob))
#;(check-equal? (get-output-bytes ob) (file->bytes "demo.pdf")))
(check-equal? (get-output-bytes ob) (file->bytes "demo.pdf")))

@ -1,63 +0,0 @@
%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
<<
/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
>>
endobj
3 0 obj
<<
/Length 18
>>
stream
1 0 0 -1 0 792 cm
endstream
endobj
6 0 obj
<<
/Producer (PDFKit)
/CreationDate (D:20170512224816Z)
/Creator (PDFKit)
>>
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 7
0000000000 65535 f
0000000395 00000 n
0000000346 00000 n
0000000186 00000 n
0000000119 00000 n
0000000015 00000 n
0000000254 00000 n
trailer
<<
/Info 6 0 R
/Root 2 0 R
/Size 7
>>
startxref
452
%%EOF
Loading…
Cancel
Save