From creelman.david at gmail.com Wed Nov 7 05:54:01 2012 From: creelman.david at gmail.com (David Creelman) Date: Wed, 7 Nov 2012 16:54:01 +1100 Subject: [cl-typesetting-devel] Problem with draw-block Message-ID: <20121107055401.GA6591@fresnel.home.lan> Hi, I'm trying to print out some content that I've defined in the usual compile-text way, but via draw-block rather than via draw-pages. I'm wanting to use draw-block because it has a :rotate key which I'm wanting to use. Below is first-doc2 using draw-pages which works and a very similar demo first-doc using draw-block that doesn't ? (defun first-doc2 (&key (file "/tmp/first-doc.pdf")) (tt:with-document () (let ((content (tt:compile-text () (tt:paragraph () "Generated with Cl-Pdf and Cl-typesetting")))) (tt:draw-pages content) (when pdf:*page* (typeset:finalize-page pdf:*page*)) (tt:write-document file)))) (defun first-doc (&key (file "/tmp/first-doc.pdf")) (tt:with-document () (let ((content (tt:compile-text () (tt:paragraph () "Some demo text" )))) (tt::draw-block content 10 10 300 300) (when pdf:*page* (typeset:finalize-page pdf:*page*)) (tt:write-document file)))) The astute reader will note that the first-doc2 is a verbatim copy of the example code in cl-pdf-doc.pdf (comes in with cl-typesetting via quicklisp). I kind of thought that draw-block would work in the same way as draw-pages, but it obviously needs more. The error I get is There is no applicable method for the generic function # when called with arguments (NIL). [Condition of type SIMPLE-ERROR] Restarts: 0: [RETRY] Retry calling the generic function. 1: [RETRY] Retry SLIME REPL evaluation request. 2: [*ABORT] Return to SLIME's top level. 3: [ABORT] Abort thread (#) Backtrace: 0: ((SB-PCL::FAST-METHOD NO-APPLICABLE-METHOD (T)) # # # NIL) 1: (SB-PCL::CALL-NO-APPLICABLE-METHOD # (NIL)) 2: (PDF:ADD-FONT-TO-PAGE # :EMBED :DEFAULT) 3: (PDF:SET-FONT # 12.0) 4: ((LABELS TYPESET::END-TEXT-CHUNK :IN TYPESET::STROKE)) 5: ((SB-PCL::FAST-METHOD TYPESET::STROKE (TYPESET::TEXT-LINE T T)) # # # 0 -5.3197145e-6)[:EXTERNAL] 6: ((SB-PCL::FAST-METHOD TYPESET::STROKE ..)) 7: ((SB-PCL::FAST-METHOD TYPESET::DRAW-BLOCK (T T T T T)) ..) 8: (FIRST-DOC :FILE "jo.pdf") 9: (SB-INT:SIMPLE-EVAL-IN-LEXENV (FIRST-DOC :FILE "jo.pdf") #) 10: (EVAL (FIRST-DOC :FILE "jo.pdf")) --more-- Any help appreciated. Thanks David From marc.battyani at fractalconcept.com Wed Nov 7 15:24:04 2012 From: marc.battyani at fractalconcept.com (Marc Battyani) Date: Wed, 07 Nov 2012 10:24:04 -0500 Subject: [cl-typesetting-devel] Problem with draw-block In-Reply-To: <20121107055401.GA6591@fresnel.home.lan> References: <20121107055401.GA6591@fresnel.home.lan> Message-ID: <509A7D14.4010105@fractalconcept.com> On 7/11/12 24:54 , David Creelman wrote: > Hi, > I'm trying to print out some content that I've defined in the usual compile-text way, but > via draw-block rather than via draw-pages. I'm wanting to use draw-block because it has > a :rotate key which I'm wanting to use. > > Below is first-doc2 using draw-pages which works and a very similar demo first-doc using > draw-block that doesn't ? > > (defun first-doc2 (&key (file "/tmp/first-doc.pdf")) > (tt:with-document () > (let ((content (tt:compile-text () > (tt:paragraph () "Generated with Cl-Pdf and Cl-typesetting")))) > (tt:draw-pages content) > (when pdf:*page* (typeset:finalize-page pdf:*page*)) > (tt:write-document file)))) > > (defun first-doc (&key (file "/tmp/first-doc.pdf")) > (tt:with-document () > > (let ((content (tt:compile-text () > (tt:paragraph () "Some demo text" )))) > > (tt::draw-block content 10 10 300 300) > (when pdf:*page* (typeset:finalize-page pdf:*page*)) > (tt:write-document file)))) > > The astute reader will note that the first-doc2 is a verbatim copy of the example code in > cl-pdf-doc.pdf (comes in with cl-typesetting via quicklisp). > > I kind of thought that draw-block would work in the same way as draw-pages, but it obviously > needs more. draw-block needs a page to write on. (defun first-doc (&key (file "~/doc1.pdf")) (tt:with-document () (let ((content (tt:compile-text () (tt:paragraph () "Some demo text" )))) (pdf:with-page () (tt::draw-block content 10 700 300 300)) (when pdf:*page* (typeset:finalize-page pdf:*page*)) (tt:write-document file)))) BTW the coordinates origin is the bottom left of the page so 10 is too small for y and I've put 700 instead. Marc From creelman.david at gmail.com Wed Nov 7 21:12:03 2012 From: creelman.david at gmail.com (David Creelman) Date: Thu, 8 Nov 2012 08:12:03 +1100 Subject: [cl-typesetting-devel] Problem with draw-block In-Reply-To: <509A7D14.4010105@fractalconcept.com> References: <20121107055401.GA6591@fresnel.home.lan> <509A7D14.4010105@fractalconcept.com> Message-ID: <20121107211203.GA17926@fresnel.home.lan> On Wed, Nov 07, 2012 at 10:24:04AM -0500, Marc Battyani wrote: <> > > Marc Hi Marc, Thanks so much. That works now. I was trying to use cl-pdf on its own, and was kind of heading down the path of gtting it to do what cl-typesetting does. But now that this works and I can rotate the page 90 degrees, I can use cl-typesetting instead and have all of the extra typesetting stuff for free. Very nice. Cheers David