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

Printing - retrieving the page range and other prJob parms



*Resending previous mail message - mail bounced:
    Date:   Tue, 5 May 1992 14:49:46 -0400
    From:   Mail Delivery Subsystem <MAILER-DAEMON@brazil.cambridge.apple.com>
    Message-Id: <9205051849.AA20873@brazil.cambridge.apple.com>
    >>> RCPT To:<info-mcl@cambridge.apple.com>
    <<< 550 <info-mcl@cambridge.apple.com>... User unknown
    550 <info-mcl@cambridge.apple.com>... User unknown: Not a typewriter

I've been trying to print using the mechanism specified in
Inside Macintosh II p156, but cannot retrive the correct
values for the page range from the TPrint record.

The record always tells me that the system will print
0 copies of pages 1 to 1 using draft and not spool 
printing (bjDocLoop 0).

After opening the printer (#_PrOpen) and
after returning from the Job Dialog (#_PrJobDialog ...),
(get-print-record) returns a handle to a TPrint record
which should contain the page range and copy information
but it does not. The values of the other fields of the
Tprint record appear to be correct. I have not checked
the other fields in the TPrJob record (:tprint.prJob).

Thanks,

Mark

----
;; Sample program which prints a blank page 
;; if page 1 is included in the page range and no pages if it is not.

(ccl::require-interface :printTraps)
(defconstant $err-printer 94)
(defconstant $err-printer-load 95)
(defconstant $err-printer-start 97)

(defun prchk1 (&optional (errnum $err-printer)
                         &aux (print-error (#_prError)))
  (unless (zerop print-error)
    (ccl::%signal-error errnum print-error)))


(defun print-null-doc ()
  (unwind-protect
    (with-cursor *arrow-cursor*
      (#_PrOpen)
      (prchk1 $err-printer-load)
      (let ((prec (get-print-record)))
        (when (#_PrJobDialog :ptr prec :boolean)
          (without-interrupts
           (let ((hardcopy-ptr (#_PrOpenDoc :ptr pRec :ptr
                                (%null-ptr) :ptr (%null-ptr) :ptr)))
             (with-port hardcopy-ptr
               (unwind-protect
                 (progn
                   ;; the following fields are incorrect
                   (print-db (href pRec :tprint.prJob.iFstPage)
                             (href pRec :tprint.prJob.iLstPage)
                             (href pRec :tprint.prJob.iCopies)
                             (href pRec :tprint.prJob.bJDocLoop))
                   (#_PrOpenPage :ptr hardcopy-ptr :ptr (%null-ptr))
                   (#_PrClosePage :ptr hardcopy-ptr)))
               (#_PrCloseDoc :ptr hardcopy-ptr))
             (when t
               (prchk1)
               (rlet ((StRec :tprStatus))
                 (#_PrPicFile :ptr pRec
                  :ptr (%null-ptr)
                  :ptr (%null-ptr)
                  :ptr (%null-ptr)
                  :ptr StRec)
                 ;; the following fields are correct
                 (print-db (rref stRec :tprStatus.iTotPages)
                           (rref stRec :tprStatus.iCurPage)
                           (rref stRec :tprStatus.iTotCopies)
                           (rref stRec :tprStatus.iCurCopy)))
               (prchk1)))))))
    (#_PrClose)))
(print-null-doc)