[cl-typesetting-devel] page breaks using draw-pages

Marc Battyani marc.battyani at fractalconcept.com
Mon Mar 5 22:13:42 UTC 2007


"Jonathon McKitrick" <jmckitrick at reedlarkeygroup.com> wrote

>Here's some code:
>
>(defun add-par ()
>  (paragraph (:font "Times-Roman" :font-size 24)
>  "old page")
>  :eop
>  (paragraph (:font "Times-Roman" :font-size 24)
>  "new page"))
>
>(defun report-write-to-file (filename)
>  (tt:with-document ()
>    (let* ((header (lambda (pdf:*page*)
>     (compile-text () "Header")))
>   (footer (lambda (pdf:*page*)
>     (compile-text (:font "Times-Roman" :font-size 12)
>       (paragraph (:h-align :center)
>(verbatim (format nil "~D" pdf:*page-number*))))))
>   (content
>    (compile-text () (add-par))))
>      (draw-pages content :margins '(108 72 72 72) :header header :footer
>footer)
>      (when pdf:*page* (finalize-page pdf:*page*))
>      (pdf:write-document (concatenate 'string "web/data/" filename)))))
>
>
>What I need to be able to do is generate content via function calls, since
>there is too much to fit into just this function.  But those function
>calls need to be able to generate page breaks.  In this example, 'add-par'
>is not able to create a new page.

This works OK for me:

(defun add-par ()
  (with-text-compilation
    (paragraph (:font "Times-Roman" :font-size 24)
      "old page")
    :eop
    (paragraph (:font "Times-Roman" :font-size 24)
      "new page")))


Marc




More information about the cl-typesetting-devel mailing list