Piotr Chamera | 10 Jun 20:12 2011
Picon

Re: Some problems with pdf-parser

Some corrections to previous post

Ad 2. In file cl-pdf, function make-indirect-object

This code seems to work for me correcting unexpected behaviour
but I am not sure it is correct in every case (added some formats for 
debugging):

(defun make-indirect-object (obj-number gen-number position)
   (let ((object (gethash (cons obj-number gen-number) *indirect-objects*)))
     (if object
     (progn
       (format T "obj alredy present: ~s ~s at position ~s" obj-number 
gen-number(cdr object))
       (if (zerop (cdr object)) ; some objects are created and marked 
with invalid position = 0
           (progn
         (format T " (marked for update with position=0), update 
position to ~s~%" position)
         (setf (gethash (cons obj-number gen-number) *indirect-objects*)
               (cons (car object) position)))
            (format T " (dropped older one at position ~s)~%" position))
         (car object))
     (progn
       (format T "making obj: ~s ~s position ~s ~%" obj-number 
gen-number position)
       (let ((new-object (make-instance 'indirect-object
                        :obj-number obj-number
                        :gen-number gen-number
                        :content :unread
                        :no-link t)))
         (setf (gethash (cons obj-number gen-number) *indirect-objects*) 
(cons new-object position))
         new-object)))))

Now order of reading example file is as follow:

startxref position: 89502
xref position: 89502
making obj: 4 0 position 85386
making obj: 5 0 position 89106
making obj: 8 0 position 89309
making obj: 7 0 position 0
xref position: 116
making obj: 6 0 position 16
obj alredy present: 7 0 at position 0 (marked for update with 
position=0), update position to 1150
obj alredy present: 8 0 at position 89309 (dropped older one at position 
1227)
making obj: 9 0 position 1411
making obj: 10 0 position 1554
(...)
making obj: 37 0 position 936
xref position: 85210
making obj: 1 0 position 81250
making obj: 2 0 position 81284
making obj: 3 0 position 81308
obj alredy present: 4 0 at position 85386 (dropped older one at position 
81359)
obj alredy present: 5 0 at position 89106 (dropped older one at position 
85007)

> But this reveals another problem in read-xref-and-trailer ...
Please ignore this, I misread this function, it seems ok.

--

-- 
pozdrawiam
Piotr Chamera

_______________________________________________
cl-pdf-devel site list
cl-pdf-devel@...
http://common-lisp.net/mailman/listinfo/cl-pdf-devel


Gmane