[cl-typesetting-devel] Drawing multiple pages woes.

Marc Battyani marc.battyani at fractalconcept.com
Tue May 11 15:49:36 UTC 2004


Erik Enge wrote:

> (defun draw-page (content &key (width *letter-width*) (height
> *letter-height*))
>    (let ((x 0)
>          (y height)
>          (dx width)
>          (dy height))
>      (pdf:with-page ()
>        (pdf:with-saved-state
>          (pdf:translate x y)
>          (let ((box (typeset::make-filled-vbox content dx dy)))
>            (when box
>              (typeset::stroke box 0 0)))))))
>
> I use it like this:
>
>        (pdf:with-document ()
>          (let ((content (typeset::compile-text () ...)))
>            (dolist (box (typeset::boxes content))
>              (declare (ignore box))
>              (draw-page content)))
>        ... write document to stream ...

This looks suspicious to me :)
dolist takes the list of the boxes once and uses it after so this should not
even work for one page IMO.

Something like this should work:

        (pdf:with-document ()
          (let ((content (typeset::compile-text () ...)))
            (loop while (typeset::boxes content) do
              (draw-page content))))
        ... write document to stream ...

Marc





More information about the cl-typesetting-devel mailing list