[cl-pdf-devel] Problems with Adobe Reader 7

Edi Weitz edi at agharta.de
Fri Apr 15 08:26:00 UTC 2005


On Thu, 14 Apr 2005 21:44:27 -0500, Klaus Weidner <kw at w-m-p.com> wrote:

> I'd be interested in an example, I can try to give it a go if nobody
> beats me to it...

The simple example below for me produces a file that is fine for
Acrobat Reader 6 but renders as a blank page with Reader 7.

  (in-package typeset)

  (defun foo (rows &optional (file "test-table.pdf"))
    (with-document ()
      (let ((max (make-array (length (first rows))
                             :initial-element 0)))
        (dolist (row rows)
          (loop for col in row
                for col-index from 0
                for size = (tt::compute-boxes-natural-size
                             (tt::boxes (compile-text () col))
                             #'dx)
                do (setf (aref max col-index)
                           (max (aref max col-index) size))))
        (draw-pages (compile-text ()
                      (tt:table (:col-widths (coerce max 'list) :border 1)
                                (dolist (row rows)
                                  (tt:row ()
                                          (dolist (cell row)
                                            (tt:cell () cell))))))
                    :break :after)
        (pdf:write-document file)))
    nil)

  (foo '(("one" "two" "three")
         ("Groucho" "Chico" "Harpo")
         ("do" "re" "mi")))

Cheers,
Edi.



More information about the cl-pdf-devel mailing list