[cl-typesetting-devel] multi-page documents

Marc Battyani marc.battyani at fractalconcept.com
Mon Jan 19 17:09:46 UTC 2004


"Peter Seibel" <peter at javamonkey.com> wrote:
>
> So I tried to use this code a while back, filling in the ... as best I
> could and didn't have much success at all. Before I go back to banging
> my head against it, does anyone have an example of extremely simple
> multi-page layout--I'm thinking of something along the lines of, I
> have a string containing more text than will fit on a page; what's the
> simplest way to get it turned into a multi-page PDF. No fancy
> formatting required (or even desired at this point), just text broken
> up into pages.
>

Here it is. I will add it to test.lisp.

(defun muli-page-hello (&optional (file #P"/tmp/hello.pdf"))
  (pdf:with-document ()
    (let ((content
    (compile-text ()
  (vspace 100)
  (paragraph (:h-align :centered :font "Helvetica-Bold" :font-size 50 :color
'(0.0 0 0.8))
      "cl-typesetting" :eol
      (vspace 2)
      (hrule :dy 1)
      (with-style (:font "Times-Italic" :font-size 26)
        "The cool Common Lisp typesetting system")
      (vspace 50)
        (dotimes (i 100)
          (with-style (:font "Helvetica-Oblique" :font-size 36 :color '(0.0
0 0.8))
     "Hello World!" :eol))))))
      (loop while (boxes content) do
     (pdf:with-page ()
       (pdf:set-line-width 0.1)
       (draw-block content 20 800 545 700 0))))
    (pdf:write-document file)))

>
> P.S. Marc, I know you'd rather code than write docs but a set of
> graduated cl-typesetting examples sort of like the ones in cl-pdf
> would be a useful starting point for folks like me who like to learn
> by grabbing something that works and try tweaking it in various ways.
> The current cl-typesetting example, though an impressive demo, has a
> bit much going on to be used in that way.

I don't have other examples. I use cl-typesetting in production applications
but the documents generated are embedded in these apps. I can't easily
extract them, and they would be mostly boring ;-) Nothing fancy.

So let's make a call for examples. If anybody has some examples to share
please post them to this list.

Marc





More information about the cl-typesetting-devel mailing list