On Mar 10, 2006, at 9:16 PM, Matt Denton wrote:
On the Mac this seems to work, on the PC the footer block comes up
as what seems to be 2 point text -- very very small -- and out of
alignment. I guess it has something to do with the DPI setting of
the printer and an incompatibility between the two calls, perhaps
the drawstring uses a different setting? Perhaps there is a better
way?
I have gotten in the habit of always opening a printer to have the
maximum resolution possible as shown in the following method for Page
Setup.
Function doPageSetup() As Boolean
Dim ok As Boolean
Dim newPref,s As String
gPS=new PrinterSetup
if gPS=nil then
s="Unable to create printerSetup class in doPageSetup method of
in wStart window. " _
+"Allocating more memory to this program may correct the
problem; but or now " _
+"the program must quit."
beep
msgBox s
quit
end if
if gPSSettings<>"" then
gPS.setupString=gPSSettings
end if
gPS.maxVerticalResolution=-1 // allow maximum resolution of printer
gPS.maxHorizontalResolution=-1
ok=gPS.PageSetupDialog
if ok then
gPSSettings=gPS.setupString
gxSF=gPS.horizontalResolution/72 // horizontal scale factor
gySF=gPS.verticalResolution/72 // vertical scale factor
updatePref("prtsettings",gPSSettings)
end if
return ok
End Function
You can see that I am asking for the printers maximum
resolutionNotice near the bottom the calculation of two global
variables, gxSF and gySF. These are the vertical and horizontal
scaling factors that I then use in any printing methods where I am
doing the printing with any of the "Draw" methods of the graphics
object.
The following is code that will typically appear at the start of a
method that is doing the printing.
headSize=12*gySF // heading size scaled for printer resolution
normSize=9*gySF // normal size scaled for printer resolution
pgCenter=pg.width/2 // center of the page
pg.penHeight=1*gySF
pg.penWidth=1*gxSF
pg.TextFont=kFontName
pg.TextSize=headSize // heading at 12pt
HeadSize and normSize are the two font sizes I will be using on this
page, each of these are multiplied by the scaling factor from the
Page Setup method. Also the penHeight and penWidth are multiplied by
this scaling factor. Always doing things this way I have experienced
little problem printing on either platform; however, I will admit
that the majority of my work is done a the Mac.
Here, to center the date on the page I use the code:
x=pgCenter-pg.StringWidth(dateOut)/2
pg.drawString dateOut,x,y
Where early on I had set the pgCenter to be the position of the
center of the page and now I subract one half of the width of the
string to be printed from that value and have x for positioning the
output.
Once the scaling factors have been set, to move down to the next line
I just set
y = y + pg.textHeight
or
y = y + pg.textHeight*2
to double space.
I hope this helps.
=== A Mac addict in Tennessee ===
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>