Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printers and ScaleMode

Status
Not open for further replies.

Punchinello

Programmer
Apr 25, 2003
116
US
I've added a print button to a data entry screen that let's a user select a printer and print a copy of the completed form complete with boxes around text and other simple line borders and such. I should preface this question with the fact that I have done EXTENSIVE work in Delphi doing all sorts of printing stuff but I am new to VB6 and, thus, the questions:

1. I've chosen to use TWIPS as my scale of choice because I believe that it corresponds to the printed inch on every printer despite the printer's DPI resolution - always 1440 inch - laser, matrix, etc. Is this true?

2. In order to print with, let's say, a 1/2" margin, I need to know if the printer (like a laser) has an unprintable area and, if so, subtract it from the intended margin size. I can calculate vertical and horizontal unprintable areas like so...

Top + Bottom = Printer.Height - Printer.ScaleHeight
Left + Right = Printer.Width - Printer.ScaleWidth

...but is it safe to simply divide these results by 2 to determine top and left unprintable areas? or is there a function that more directly yields those measurements?

[bigears] I'm all ears.
 

1. Yes, twips are device independent

2. Acually...
[tt]
?printer.Width-printer.ScaleWidth
720 'total unprintable area (1/2 inch)
?720/2
360
?360/1440
0.25 'unprintable area on my old dot matrix left and right sides
'so
LeftUnprintableArea = (Printer.Width - Printer.ScaleWidth) / 2

[/tt]

I hope I got that right for you.

Good Luck



In all that you do, and all that you have done, and everything you have received from it, you have to ask, is it worth it?
 
vb5, thanks for the answers, but regarding #2, I guess my real question is: can we assume that top and bottom unprintable areas always the same for all printers? For example:

With Word 97 and HP LaserJet4, I open a new document...
I go into Page Setup and set all 4 margins to zero...
Word asks do I want to fix the margins...
(it knows they are too small for the HP4)
When it fixes them, top is .25 but bottom is .21! [mad]

Now, granted 0.25 + 0.21 = 0.46 and 0.46 / 2 = 0.23 and two-hundredths of an inch isn't going to end the world, but still...

As always, the devil's in the details.
 

No I would not assume anything, because the printer in my previous answer had a zero (0) top/bottom (tractor feed dot matrix). So if you really want to get answers depending upon printer I will point you to the DeviceCapabilities API and if you do a search for that API you should find some code I have posted in the past.

Good Luck

 
vb5, thanks again for the response. I pulled a late one last night to resolve the issue and posted a helpful hint on another thread with all the details.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top