[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Printing Pics



I try to use the following code to print pictures to a laserwriter. The
code is an adaption of the hardcopy.lisp file long time ago bundled with
MCL.

The code works wonderfully when I disable Background Printing on
laserwriter driver 8.1.1 but crashes violently after printing the picture
if it is enabled.

I also tried the print-u package on cambridge.apple.com but the code looked
equivalent and also crashed my mac quite often.



Any hints ?

(defun b-print-picture (picture x y)
  (let ((pRec (make-record :TPrint)))
    (unwind-protect
      (with-cursor *arrow-cursor*
        (#_PrOpen)
        (ccl::prchk)
        (when (#_prstldialog :ptr pRec :boolean)
          (when (#_PrJobDialog :ptr pRec :boolean)
            (ignore-errors
             (without-interrupts
              (let ((hardcopy-ptr (#_PrOpenDoc :ptr pRec :long 0 :long 0
:ptr)))
                (unwind-protect
                  (progn
                    (with-dereferenced-handles ((ppRec pRec))
                      pprec
                      (ccl::prchk)
                      (unwind-protect
                        (progn
                          (#_PrOpenPage :ptr hardcopy-ptr :long 0)
                          (with-port hardcopy-ptr
                            (#_moveto 0 0)
                            (ccl::with-rectangle-arg (r 0 0 x y)
                              (#_DrawPicture picture r)
                              )
                            )
                          (#_PrClosePage :ptr hardcopy-ptr))
                        )))
                  (#_PrCloseDoc :ptr hardcopy-ptr))
                )
              (when (eq (href pRec :TprJob.bJDocLoop)
                        #$bSpoolLoop)
                (ccl::prchk)
                (rlet ((StRec :tprstatus))
                  (#_PrPicFile :ptr pRec :long 0 :long 0 :long 0 :ptr
StRec))
                (ccl::prchk))))
            )))
      (dispose-record pRec)
      (#_PrClose))))