[cl-typesetting-devel] multi-page documents
Klaus Weidner
kw at w-m-p.com
Sat Dec 20 15:59:03 UTC 2003
On Fri, Dec 19, 2003 at 07:13:38PM -0500, David J Cooper Jr wrote:
> I am thinking about how to tackle multi-page documents with
> cl-typesetting but am a bit stuck as to how to get started.
>
> Each page needs to end up inside a
>
> (pdf:with-page ... )
>
> right?
>
> So if we have a piece of content (made with typeset::compile-text),
> we need an intermediate step which figures out how to break that
> content into multiple pages, right?
Just accumulate the content using compile-text, and then let the engine
split it into pages for you.
Try something like this:
(defun draw-page (content)
(let ((x 72)
(y 720)
(dx 468)
(dy 648))
(pdf:with-page ()
(pdf:with-saved-state
(pdf:translate x y)
(let ((box (make-filled-vbox content dx dy)))
(when box
(stroke box 0 0)))))))
;; ...
(let ((content
(compile-text
()
(paragraph
"cl-typesetting" :eol
(vspace 2)
(with-style (:font "Times-Italic" :font-size 13)
"The cool Common Lisp typesetting system"))
;; ...
)))
(pdf:with-document ()
(while (boxes content)
(draw-page content))))
(pdf:write-document file)))
More information about the cl-typesetting-devel
mailing list