[cl-typesetting-devel] Non-macro interface to building documents.

Erik Enge erik at nittin.net
Tue Feb 10 22:41:39 UTC 2004


I have a list of objects.  Each object has three slots: name, 
telephone, age.  I'd like to make
a PDF document that displays this information in neat tables.  The only 
thing I don't know is
how many objects there are in my list.

(defun testpdf (&optional (file #P"/tmp/test.pdf"))
   (pdf:with-document ()
     (pdf:with-page ()
       (pdf:with-outline-level ("Example" (pdf:register-page-reference))
	(pdf:set-line-width 0.1)
	(let ((content
	       (typeset::compile-text ()
                  (typeset:paragraph (:font "Helvetica-Bold" :font-size 
16)
                    "Test document")
                  (typeset:hrule :dy 2)
                  (typeset:table (:col-widths '(100 430) :border 0)
                    (typeset:row ()
                      (typeset:cell ()
                        (typeset:paragraph ()
                          "Name"))
                      (typeset:cell ()
                        (typeset:paragraph ()
                          "Erik Enge")))
                    (typeset:row ()
                      (typeset:cell ()
                        (typeset:paragraph ()
                          "Telephone"))
                      (typeset:cell ()
                        (typeset:paragraph ()
                          "555-1234")))
                    (typeset:row ()
                      (typeset:cell ()
                        (typeset:paragraph ()
                          "Age"))
                      (typeset:cell ()
                        (typeset:paragraph ()
                          "25")))))))
           (typeset::draw-block content 20 800 545 700 0))))
     (pdf:write-document file)))

Can someone show me how I would turn that code into code that would 
essentially do the
same thing for a list of objects, as described at the top of the mail?  
I have read typo.lisp
and tables.lisp but there doesn't seem to be a functional equivalent to 
the table macro.

Thanks in advance,

Erik.





More information about the cl-typesetting-devel mailing list