[futurebasic] Re: [FB] Printing question

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : February 2007 : Group Archive : Group : All Groups

From: Robert Purves <robert.purves@...>
Date: Mon, 12 Feb 2007 12:27:08 +1300
JLemons660@... wrote:

> I have an application which generates several reports to be  
> printed. Of these a couple must be printed in landscape rather than  
> portrait orientation. Is it possible for me to program the correct  
> orientation into the printing function? As it is now I alert the  
> user when he/she responds to DEF PAGE that it is necessary but I  
> have no assurance the user will respond appropriately.

Call SetPrinterOrientation, passing either _kPMLandscape or  
_kPMPortrait, as in the demo below
Robert P.

'-----------
toolbox fn PMValidatePageFormat( PMPageFormat pageFormat, Boolean  
*result) = OSStatus

local fn SetPrinterOrientation( orient as PMOrientation )
'~'1
dim as OSStatus err
dim as Handle dummy
dim as PMRect pagePMRect
dim as Rect pageRect
dim as Boolean @ valid

dummy = PRHandle
err = fn PMSetOrientation( gFBPageFormat, orient, _false )
long if ( err == _noErr )
// make the orientation stick
call PMValidatePageFormat( gFBPageFormat, @valid )
// fix the PRHandle to contain the new adjusted page rect
call PMGetAdjustedPageRect( gFBPageFormat, @pagePMRect )
pageRect.top = pagePMRect.top
pageRect.left = pagePMRect.left
pageRect.bottom = pagePMRect.bottom
pageRect.right = pagePMRect.right
BlockMove @pageRect, @gFBPRHandle&..prInfo.rPage`, sizeof( Rect )
end if
end fn = err


// main program
def lprint
long if ( prCancel == 0 )
fn SetPrinterOrientation( _kPMLandscape )
route _toPrinter
print "Landscape"
route _toScreen
close lprint
end if

def lprint
long if ( prCancel == 0 )
fn SetPrinterOrientation( _kPMPortrait )
route _toPrinter
print "Portrait"
route _toScreen
close lprint
end if

stop "Done"
'-----------