[cl-typesetting-devel] Problem with draw-block

David Creelman creelman.david at gmail.com
Wed Nov 7 05:54:01 UTC 2012


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
  #<STANDARD-GENERIC-FUNCTION PDF::FONTS (2)>
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 (#<THREAD "repl-thread" RUNNING {BF66621}>)

Backtrace:
  0: ((SB-PCL::FAST-METHOD NO-APPLICABLE-METHOD (T)) #<unused argument> #<unused argument> #<STANDARD-GENERIC-FUNCTION PDF::FONTS (2)> NIL)
  1: (SB-PCL::CALL-NO-APPLICABLE-METHOD #<STANDARD-GENERIC-FUNCTION PDF::FONTS (2)> (NIL))
  2: (PDF:ADD-FONT-TO-PAGE #<PDF:FONT helvetica {AFF1BE9}> :EMBED :DEFAULT)
  3: (PDF:SET-FONT #<PDF:FONT helvetica {AFF1BE9}> 12.0)
  4: ((LABELS TYPESET::END-TEXT-CHUNK :IN TYPESET::STROKE))
  5: ((SB-PCL::FAST-METHOD TYPESET::STROKE (TYPESET::TEXT-LINE T T)) #<unavailable argument> #<unavailable argument> #<TYPESET::TEXT-LINE {C5AAD69}> 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") #<NULL-LEXENV>)
 10: (EVAL (FIRST-DOC :FILE "jo.pdf"))
 --more--

Any help appreciated.

Thanks
David





More information about the cl-typesetting-devel mailing list