[futurebasic] Re: [FB] OS X printing

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

From: Robert Purves <robert.purves@...>
Date: Tue, 24 Dec 2002 12:26:56 +1300
On Tuesday, December 24, 2002, at 02:10  AM, Douglas Stemen wrote:

> I appreciate your help with this.
>
> This routine does allow PRHANDLE to get the correct page boundries 
> that correspond with landscape printing. However, in my program when 
> FN GetAdjustedPageRect is called the print orientation is incorrectly 
> switched back to portrait when printing to a printer (even though the 
> width is correct for landscape)


I think that FN GetAdjustedPageRect is innocent.  Something about the 
act of printing resets the default print orientation, as shown in the 
demo below. (The first page is printed landscape, as desired, but the 
second is in portrait orientation).  The culprit may be  close lprint.

You will have to call PMSetOrientation each time you print, to set 
_kPMLandscape.


'---------------
'~'A
'                           CPU : Carbon
'~'B
_kPMPortrait  = 1
_kPMLandscape = 2
toolbox fn PMSetOrientation( PMPageFormat pageFormat, ¬
                 UInt16 orientation, Boolean lock ) = OSStatus


dim as Handle    myPRHandle
dim as OSStatus  err

myPRHandle = prHandle

// set landscape orientation
err   = fn PMSetOrientation( gFBPageFormat, _kPMLandscape, _false )
if err then stop "PMSetOrientation error " + str$( err )

def lprint
long if prCancel == _false
route _toPrinter
print "Landscape :-) "
route _toScreen
close lprint
end if

def lprint
long if prCancel == _false
route _toPrinter
print "Reverts to Portrait :-( "
route _toScreen
close lprint
end if

do
HandleEvents
until 0
'---------------


Robert P.