[cl-typesetting-devel] multi-page documents

David J Cooper Jr david.cooper at genworks.com
Sat Dec 20 16:38:53 UTC 2003


Ok I will check it out. Somehow I didn't realize the page-breaking
stuff was already in there. Now some of the things on Marc's to-do
list (like the need to add multi-page support for tables), make more
sense.

The sample document I am working with has bullet lists. I have a
really clunky implementation of bullet lists now, using tables with no
borders, but Marc has said this is overkill and bullet (and number)
lists would be better done simply with first-line-indent and
left-margin, which presumably will already work with the page
breaking. 

So maybe everything I need is already in there. But i will report back
any potentially useful additions I end up with (like friendlier syntax
for bullet lists, multiple pages, etc).

P.S. I am using cl-interpol for adding special characters like
     bullets, which seems to be working out well.


Klaus Weidner writes:
 > 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