[futurebasic] Re: [FB] Print coordinates

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 2002 : Group Archive : Group : All Groups

From: Alain Pastor <pixmix@...>
Date: Sun, 09 Jun 2002 16:41:04 +0200
> 
> ALSO
> How do I find the size of a page print area? The PRHANDLE description in the
> reference manual is difficult to understand without an example to illustrate
> its use.
> Thank you

Barrie,

I don't know exactly, what is your problem. But, I've retrieved the
piece of code below (not Carbon compatible) that I wrote some time ago
for technical support, maybe it might help (caution with linebreaks):

/*
     Records non définis dans les headers
*/
BEGIN RECORD TPrInfo
DIM iDev  AS short 'Font mgr/QuickDraw device code'
DIM iVRes AS short 'Resolution of device, in device coordinates'
DIM iHRes AS short '..note: V before H => compatable with Point.'
DIM rPage AS Rect 'The page (printable) rectangle in device coordinates.'
END RECORD

' Print Info Record: The parameters needed for page composition. '

BEGIN RECORD TPrStl
DIM wDev   AS short
DIM iPageV AS short
DIM iPageH AS short
DIM bPort  AS SInt8
DIM feed   AS SInt8
END RECORD

BEGIN RECORD TPrXInfo
DIM iRowBytes AS short
DIM iBandV    AS short
DIM iBandH    AS short
DIM iDevBytes AS short
DIM iBands    AS short
DIM bPatScale AS SInt8
DIM bUlThick  AS SInt8
DIM bUlOffset AS SInt8
DIM bUlShadow AS SInt8
DIM scan      AS SInt8
DIM bXInfoX   AS SInt8
END RECORD

BEGIN RECORD TPrJob
DIM iFstPage  AS short 'Page Range.'
DIM iLstPage  AS short
DIM iCopies   AS short 'No. copies.'
DIM bJDocLoop AS SInt8 'The Doc style: Draft, Spool, .., and ..'
DIM fFromUsr  AS Boolean 'Printing from an User's App (not PrApp) flag'
DIM pIdleProc AS PROC 'The Proc called while waiting on IO etc.'
DIM pFileName AS PTR'(StringPtr)'Spool File Name: NIL for default.'
DIM iFileVol  AS short 'Spool File vol, set to 0 initially'
DIM bFileVers AS SInt8 'Spool File version, set to 0 initially'
DIM bJobX     AS SInt8 'An eXtra byte.'
END RECORD

BEGIN RECORD TPrint
DIM iPrVersion AS short'(2) Printing software version
DIM prInfo     AS TPrInfo'(14) the PrInfo data associated with the
current style.
DIM rPaper     AS Rect'(8) The paper rectangle [offset from rPage]
DIM prStl      AS TPrStl'8) This print request's style.
DIM prInfoPT   AS TPrInfo'(14) Print Time Imaging metrics
DIM prXInfo    AS TPrXInfo'(16) Print-time (expanded) Print info record.
DIM prJob      AS TPrJob'(20) The Print Job request (82) Total of the
above 120-82 = 38 bytes needed to fill 120
DIM printX[18] AS short'Spare to fill to 120 bytes!
END RECORD

'~Main test
#IF NDEF _usingLiteRuntime
WINDOW 1,"",(0,0)-(SYSTEM(_scrnWidth),SYSTEM(_scrnHeight) - FN GetMBarHeight),_dialogPlain
#ENDIF
DIM PrH AS ^^TPrint

PrH = PRHANDLE

LONG IF PrH
PRINT "Printer Driver version number:",PrH..iPrVersion
PRINT
PRINT "• THE PrInfo DATA ASSOCIATED WITH THE CURRENT STYLE •"
PRINT "Font mgr/QuickDraw device code                       :";
PRINT PrH..prInfo.iDev

PRINT "Resolution of device, in device coordinates          :";
PRINT PrH..prInfo.iVRes;
PRINT " X";
PRINT PrH..prInfo.iHRes;
PRINT " (note: V before H => compatable with Point)"

PRINT "The page (printable) rectangle in device coordinates : ";
PRINT PrH..prInfo.rPage

PRINT "The paper rectangle [offset from rPage]              : ";
PRINT PrH..rPaper

PRINT
PRINT "• THIS PRINT REQUEST'S STYLE •"

PRINT "Device number. High byte is refNum, low byte is variant :";
PRINT PrH..prStl.wDev;
PRINT " (Device number:";PrH..prStl.wDev.nil`;
PRINT ", Variant:";PrH..prStl.wDev.1`;" => ";
SELECT PrH..prStl.wDev.1`
CASE 0: PRINT "hires";
CASE 1: PRINT "portrait";
CASE 2: PRINT "square dots";
CASE 3: PRINT "Zoom";
CASE 4: PRINT "scroll";
END SELECT
PRINT ")"

PRINT "Paper height                                            :";
PRINT PrH..prStl.iPageV;" (in 1/120th-inch units)"
PRINT " Paper width                                            :";
PRINT PrH..prStl.iPageH;" (in 1/120th-inch units)"

PRINT "I/O port number                                         :";
PRINT PrH..prStl.bPort

PRINT "Type of paper feed                                      :";
PRINT PrH..prStl.feed;
SELECT PrH..prStl.feed
CASE 0: PRINT " (cut sheet)"
CASE 1: PRINT " (fanfold)"
CASE 2: PRINT " (mech out)"
CASE 3: PRINT " (?)"
END SELECT

PRINT
PRINT "• PRINT TIME IMAGING METRICS •"

PRINT "Font mgr/QuickDraw device code                       :";
PRINT PrH..prInfoPT.iDev

PRINT "Resolution of device, in device coordinates          :";
PRINT PrH..prInfoPT.iVRes;
PRINT " X";
PRINT PrH..prInfoPT.iHRes;
PRINT " (note: V before H => compatable with Point)"

PRINT "The page (printable) rectangle in device coordinates : ";
PRINT PrH..prInfoPT.rPage

PRINT
PRINT "• PRINT-TIME (EXPANDED) PRINT INFO RECORD •"
PRINT "rowBytes (as in a bitMap) for a band :";
PRINT PrH..prXInfo.iRowBytes

PRINT "Height of a band, in printer dots    :";
PRINT PrH..prXInfo.iBandV

PRINT "Width of a band                      :";
PRINT PrH..prXInfo.iBandH

PRINT "Size of buffer needed by PrPicFile   :";
PRINT PrH..prXInfo.iDevBytes

PRINT "Number of bands per page             :";
PRINT PrH..prXInfo.iBands

PRINT "Pattern scaling factor               :";
PRINT PrH..prXInfo.bPatScale

PRINT "Underlining parameters               :";
PRINT PrH..prXInfo.bUlThick;
PRINT ",";
PRINT PrH..prXInfo.bUlOffset;
PRINT ",";
PRINT PrH..prXInfo.bUlShadow

PRINT "Band scanning direction code         :";
PRINT PrH..prXInfo.scan;
SELECT PrH..prXInfo.scan
CASE 0: PRINT " (top-to-bottom)"
CASE 1: PRINT " (bottom-to-top)"
CASE 2: PRINT " (left-to-right)"
CASE 3: PRINT " (right-to-left)"
END SELECT

PRINT
PRINT "• JOB •"
PRINT "Page number of first page to print (1-based) :";
PRINT PrH..prJob.iFstPage

PRINT "Last page to print                           :";
PRINT PrH..prJob.iLstPage

PRINT "Number of copies to print                    :";
PRINT PrH..prJob.iCopies

PRINT "Print method                                 :";
PRINT PrH..prJob.bJDocLoop;
SELECT PrH..prJob.bJDocLoop
CASE 0:     PRINT " (Draft)"
CASE 1:     PRINT " (Spooled)"
CASE ELSE : PRINT " (?)"
END SELECT

PRINT "Printing from an User's App (not PrApp) flag :";
PRINT PrH..prJob.fFromUsr

PRINT "The Proc called while waiting on IO etc.     :";
PRINT PrH..prJob.pIdleProc

PRINT "Spool File Name (StringPtr): NIL for default : '";
PRINT PrH..prJob.pFileName.nil$;"'"

PRINT "Spool File vol, set to 0 initially           :";
PRINT PrH..prJob.iFileVol

PRINT "Spool File version, set to 0 initially       :";
PRINT PrH..prJob.bFileVers

END IF

#IF NDEF _usingLiteRuntime
DO
HANDLEEVENTS
UNTIL FN BUTTON
#ENDIF

-- 
Cheers,

Alain