From Marc.Battyani at fractalconcept.com Mon May 2 20:53:07 2005 From: Marc.Battyani at fractalconcept.com (Marc Battyani) Date: Mon, 2 May 2005 22:53:07 +0200 Subject: [cl-typesetting-devel] [ANNOUNCE] cl-pdf-parser Message-ID: <05b701c54f58$f49ec790$0a02a8c0@marcxp> This is the first public release of cl-pdf-parser. cl-pdf-parser enables cl-pdf to draw on existing pages and add new pages to an existing PDF document. I have been using this for a long time but it was based on Lispworks parser generator and I was too lazy to write a recursive descent parser. Now that cl-yacc is available, I used it to generate the parser. Here is an example of an existing commercial pdf document opened by cl-pdf-parser and modified with cl-pdf. (The first page have been reduced and drawn a second time rotated+some cl-pdf texts, the second page have been written on and a third page have been added to the document.) http://fractalconcept.com/fcweb/download/cl-pdf-parser-example.pdf cl-pdf-parser is in the cl-pdf repository. The full repository is here: http://www.fractalconcept.com:8000/public/open-source/ (It's a subversion 1.1 repository.) The projects repositories are: http://www.fractalconcept.com:8000/public/open-source/cl-pdf/ http://www.fractalconcept.com:8000/public/open-source/cl-typesetting/ http://www.fractalconcept.com:8000/public/open-source/mod_lisp/ There are also tarballs available http://www.fractalconcept.com/download/cl-pdf-current.tgz http://www.fractalconcept.com/download/cl-typesetting-current.tgz BTW the (really outdated) home pages for these projects are here: http://www.fractalconcept.com/asp/html/cl-pdf.html http://www.fractalconcept.com/asp/html/cl-typesetting.html http://www.fractalconcept.com/asp/html/mod_lisp.html Marc From marc.battyani at fractalconcept.com Wed May 4 17:13:39 2005 From: marc.battyani at fractalconcept.com (Marc Battyani) Date: Wed, 4 May 2005 19:13:39 +0200 Subject: [cl-typesetting-devel] Re: [ANNOUNCE] cl-pdf-parser References: <05b701c54f58$f49ec790$0a02a8c0@marcxp> Message-ID: <0b9e01c550cc$9ea8cbe0$0a02a8c0@marcxp> cl-pdf-parser: Replacement of the LALR parser by a recursive descent one from Arthur Lemmens. Removed cl-yacc directory. Marc From marc.battyani at fractalconcept.com Tue May 31 16:41:44 2005 From: marc.battyani at fractalconcept.com (Marc Battyani) Date: Tue, 31 May 2005 18:41:44 +0200 Subject: [cl-typesetting-devel] Re: [cl-pdf-devel] Question about tables References: Message-ID: <02f601c565ff$a2562e70$0a02a8c0@marcxp> "Peter Seibel" writes: > [This message got rejected by the cl-typesetting list--maybe I'm not > subscribed under this address to that list. Or did that list get > decomissioned? Anyway, I'm sure someone here can help too.] I've put the cl-typesetting mailing list in copy. > I'm trying to make some PDF reports with a bunch of spreadsheet-style > tables. Here's some sample code: > > (defpackage :com.gigamonkeys.table-test (:use :cl :typeset)) > > (in-package :com.gigamonkeys.table-test) > > (defun make-test-data (columns rows) > (loop for c from 0 below columns > collect > (list > (format nil "COLUMN ~d" c) > (coerce (loop repeat rows collect (+ 10000 (random 10000d0))) 'vector)))) > > (defun compute-column-widths (columns) > (let ((cols (length columns))) > (loop repeat cols collect (floor (- 792 (* 2 36)) cols)))) > > (defun test-cell-wrapping (columns &optional (file "/tmp/analysis.pdf")) > (with-document () > (let ((content > (compile-text () > (paragraph (:h-align :center :font "Helvetica-Bold" :font-size 18 :color '(0.0 0 0.0)) "Test" :eol) > (with-style (:font "Helvetica" :font-size 6) > (table (:col-widths (compute-column-widths columns) :splittable-p t) > (header-row () > (loop for label in (mapcar #'first columns) > do (cell () (with-style (:font "Helvetica-Bold") label)))) > > (loop for i from 0 below (length (second (first columns))) do > (row () > (loop for col in (mapcar #'second columns) > do (cell () (put-string (format nil "~,2f" (aref col i))))))))) > (vspace 10) > :eol))) > (draw-pages content :size :letter :orientation :landscape :margins '(36 36 36 36)) > (when pdf:*page* (finalize-page pdf:*page*)) > (pdf:write-document file)))) > > I have three main questions: > > 1) Why doesn't my compute-column-widths work correctly--it seems that > I'm taking the total width of the page, subtracting the width of > the left and right margins and then dividing by the number of > columns. Yet the table, while starting at what looks like the > correct left margin, goes to or even beyond the right edge of the > page. To see this try evaluating: > > (test-cell-wrapping (make-test-data 10 10)) There is the cell-padding also. Have you counted it ? > 2) Why does the content of the cells get broken over two lines even > when there's seemingly plenty of room left in the cell. To see > what I'm talking about try: > > (test-cell-wrapping (make-test-data 15 10)) > > 3) How do I adjust the line height to make the height of the rows > smaller? For 2 and 3, the problem is probably that each cell is is a cl-typesetting engine and the "parent" style is not passed to the cells (yet...). If you wrap your cell's put-string into a with-style, it looks ok for me. Marc