[cl-typesetting-devel] Problem with big table

Peter Seibel peter at gigamonkeys.com
Mon Oct 31 05:15:47 UTC 2005


I'm generating a document--with the function shown below--that  
consists pretty much of a just a single huge table (> 2,000 rows).  
Everything works fine except on the last page the output goes all the  
way to the bottom of the page, ignoring the bottom margin, and is cut  
off, missing some number of rows and the paragraph following the  
table. I have not yet synced up to the code Marc just released--is  
there any reason to believe this problem will go away if I do?

-Peter

(defun checklist (titles-and-loc &optional (file #P"/tmp/ 
checklist.pdf"))
   (let ((font-size 9))
     (with-document ()
       (let ((content
          (compile-text ()
            (table (:border 0 :cell-padding 1 :col-widths (list 15 (*  
4.5 *points-per-inch*) (* 2 *points-per-inch*) (* .5 *points-per- 
inch*)) :splittable-p t)
          (header-row ()
            (loop for label in '("" "Title" "Call#" "Pos")
               do (cell ()
                (paragraph (:font "Helvetica-Bold" :font-size font- 
size :h-align :center) label))))
          (loop for (title loc) in titles-and-loc
             for num from 0
             for pos = (format nil "p. ~d ~d~d~%" (1+ (floor num 72))  
(char "ABCDEFGH" (mod num 8)) (1+ (mod (floor num 8) 9)))
             do
             (row (:background-color (if (evenp num) '(.95 .95 .95)  
'(1 1 1)))
               (cell (:v-align :center)
             (user-drawn-box
              :dx 8 :dy 8
              :stroke-fn #'(lambda (box x y)
                     (pdf:with-saved-state
                       (pdf:translate x y)
                       (pdf:rectangle 0 0 (+ 2 (- (typeset::dx box)))  
(+ 2  (- (typeset::dy box))))
                       (pdf:close-and-stroke)))))
               (cell () (paragraph (:font "Helvetica" :font-size font- 
size :h-align :left) title))
               (cell () (paragraph (:font "Helvetica" :font-size font- 
size :h-align :left) loc))
               (cell () (paragraph (:font "Helvetica" :font-size font- 
size :h-align :left) pos)))))
            (paragraph (:font "Helvetica" :font-size font-size :h- 
align :center) "-#-")
            :eol)))
     (draw-pages  
content :size :letter :orientation :portrait :margins 36)
     (when pdf:*page* (finalize-page pdf:*page*))
     (pdf:write-document file)))))


-- 
Peter Seibel           * peter at gigamonkeys.com
Gigamonkeys Consulting * http://www.gigamonkeys.com/
Practical Common Lisp  * http://www.gigamonkeys.com/book/





More information about the cl-typesetting-devel mailing list