gettingstarted
[Top] [All Lists]

Re: Need help Printing on PC

To: Getting Started <gettingstarted at lists dot realsoftware dot com>
Subject: Re: Need help Printing on PC
From: Harrie Westphal <harriew at frontiernet dot net>
Date: Mon, 28 Feb 2005 14:32:41 -0600
Delivered-to: gettingstarted at lists dot realsoftware dot com
Lennox,

I am by no means an expert on printing; but have you looked at what the values of the HorizontalResolution and VerticalResolution are in the PrinterSetup class after your line:

ok = ps.pagesetupdialog

If you are getting a tiny representation of your output in the upper left corner of the page it seems like these values are higher than you expect and you are going to have to use a horizontal and vertical scale factor to multiply your textsize and distances by. I have gotten in the habit of always setting a scale factor when printing. Something like:

  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) // update preference you can ignore this
  end if

Then the scale factors are used like the following to set the penHeight, penWidth, and textSize of the graphics object:

  pg.penHeight=1*gySF
  pg.penWidth=1*gxSF
  pg.TextSize=10*gxSF  // everything one size in this report

If I want to print something starting 15 pixels from the left edge, and 20 pixels down from the top I would use something likeL

g.drawstring theString, 15*gxSF, 20*gySF

It is a bit of extra work but once done it can be run on any printer with any resolution the user chooses. It seems to work for me on both the Mac and Windows XP. I have no Linux experience. I remember that this threw me for a loop the first time I encountered it.

The only thing that I am not absolutely sure of, is if dividing by 72 is the proper value when running on a PC. Seems to me I recall the number 96 having something to do with the screen resolution on a PC. However, things are working for me using 72 in the scale factor calculations. If someone else knows something different hopefully they will pipe in and say so.

=== A Mac addict in Tennessee ===

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>