[cl-typesetting-devel] making a huge poster with cl-typesetting

Chisheng Huang cph at chi-square-works.com
Mon Aug 30 23:34:17 UTC 2004


> No problem. David J Cooper Jr used cl-typesetting and cl-pdf to typeset a
> nice GDL pamphlet.
> Here it is:
> http://www.genworks.com/downloads/gdl-pamphlet-portrait.pdf

Thanks for the URL.

>>   2. I'm not sure how to get the multicolumn format I need.  There are
> TABLE,
>>      ROW, and CELL in CL-TYPESETTING but I need the text to flow from the
>>      bottom of a column to the top of the next column to the right.
>
> For 1 and 2: You can't use the top level functions for generating a document
> as they don't support multi-columns yet. You have to manually call
> draw-block with your columns coordinates as shown in full-example in
  ^^^^^^^^^^
Yes, I came across this little gem in test.lisp while poking around and 
thought it was the key to create a multicolumn poster.  Thank you for the
confirmation.

>>   3. All my graphics stuff is generated by CL-PDF separately.  Any way to
>>      import these PDF files into a PDF file (the poster being generated by
>>      CL-TYPESETTING)?
>
> Not yet. The best way for now is to directly call the cl-pdf generating
> function directly like it's done in the examples.

Directly calling CL-PDF to generate plots is not feasible for my case:(
Attached at the end is some code I hacked up.  The problem is it does not
work:(  It will generate 3 pdf files: red.pdf, green.pdf, and test.pdf.
The file test.pdf is supposed to import and display red.pdf and green.pdf.
But using acroread on a Linux box only gives me a grey background enlarged
to 1600%.  Could someone please take a look at the code and tell me what
I'm missing?  I really hate to use the sucky CorelDRAW on a PC to make
a poster.

Best wishes,

-cph

ps.  PDF:ADD-EXTERNAL-LINK is not what I want.  Sorry about that noise
     in my previous email.

;;==================================================================

(in-package :pdf)

(defclass reference-xobject (indirect-object)
  ((name  :reader name
	  :initform (gen-name "/REFXOBJ")
	  :initarg :name)
   (filename :reader filename
	     :initarg :filename)
   (page :reader page
	 :initform 0
	 :initarg :page)))

(defmethod initialize-instance :after ((ref-xobj reference-xobject)
				       &rest initargs
				       &key filename page
				       (llx 0) (lly 0)
				       (urx 1000000) (ury 1000000)
				       &allow-other-keys)
  (declare (ignore initargs))
  (let ((ref-dict (make-instance 'dictionary
				 :dict-values `(("/F" . ,(concatenate 'string
								      "("
								      filename
								      ")"))
						("/Page" . ,page)))))
    (setf (content ref-xobj)
	  (make-instance 'pdf-stream
			 :no-compression t
			 :dict-values `(("/Type" . "/XObject")
					("/Subtype" . "/Form")
					("/BBox" . ,(format nil
							    "[~A ~A ~A ~A]"
							    llx lly urx ury))
					("/Ref" . ,ref-dict))))))

(defun add-reference-xobjects-to-page (&rest reference-xobjects)
  (dolist (rx reference-xobjects)
    (add-dict-value (xobjects *page*) (name rx) rx)))

(defun paint-reference-xobject (ref-xobj)
  (format *page-stream* "~a Do~%" (name ref-xobj)))

(defun draw-reference-xobject (ref-xobj x y)
  (move-to x y)
  (paint-reference-xobject ref-xobj))

;;------------------------------------------------------------------
;; testing...

(with-document ()
  (with-page (:bounds #(0 0 100 100))
    (set-rgb-fill 1.0 0.0 0.0)
    (rectangle 0 0 100 100)
    (fill-path))
  (write-document "/tmp/red.pdf"))

(with-document ()
  (with-page (:bounds #(0 0 100 100))
    (set-rgb-fill 0.0 1.0 0.0)
    (rectangle 0 0 100 100)
    (fill-path))
  (pdf:write-document "/tmp/green.pdf"))

(with-document ()
  (with-page ()
    (with-outline-level ("test" (register-page-reference))
      (let ((red (make-instance 'reference-xobject
				 :name "red"
				 :filename "/tmp/red.pdf"
				 :page 0
				 :urx 100
				 :ury 100))
	    (green (make-instance 'reference-xobject
				  :name "green"
				  :filename "/tmp/green.pdf"
				  :page 0
				  :urx 100
				  :ury 100)))
	(add-reference-xobjects-to-page red green)
	(draw-reference-xobject red 200 200)
	(draw-reference-xobject green 400 400)
	(rectangle 200 200 200 200)
	(stroke))))
  (write-document "/tmp/test.pdf"))





More information about the cl-typesetting-devel mailing list