Re: Feelin' left out of it
- From: "Jim Y" <jj819stuffNOSPAM@xxxxxxxxxxx>
- Date: Wed, 27 Sep 2006 23:33:17 -0400
I have not seen any of your posts regarding this. I tried your code with a Lexmark P3150.
Measuring the distance with an engineering scale (0.02 inch increments), I have 0.04 inches. Your
program yields 40, 600 and 0.07 inches.
Jim Y
"Mike Williams" <mike@xxxxxxxxxxxxxxxxx> wrote in message
news:uKGks$n4GHA.4196@xxxxxxxxxxxxxxxxxxxxxxx
Hi everyone
I've asked in a few recent posts if anyone would do me a favour and run some test code on their
printer (from VB) and let me know what happens. To be frank, I'm feelin' a bit "left out of it".
Not a single person (other than the person I was helping at that time) has responded. I feel so
sad, fellas. Anyone like to put me out of my misery? (No, sorry, not like that!). I'm particularly
interested in the results of anyone who hapens to have a HP PhotoSmart 2575 printer, but I'd like
to know the results for any printer if you don't have that specific make or model. To save me
typing it all again, here is an extract from a recent newsgroup answer I posted . . .
Please respond if you can. You'll have it on your conscience if you don't and if in a few days you
read about me jumpin' off the edge of Tower Bridge :-(
Mike
. . . by the way Dale, I'd appreciate it if you would kindly do me a favour.
I note that the printer code reports the bottom margin as being 0.2 inches
whereas you report that the text is actually clipped at the bottom of the
page at about 0.25 inches. This could be something to do with the way the
RTB SelPrint is behaving (which of course you no longer need to worry about
now that you have some working alternative code), but it could instead
possibly be caused by a problem with your printer.
Positioning and / or clipping problems such as this could be caused by the
printer driver reporting an incorrect value for its "unprintable top
margin". At the moment I'm having a bit of a "chinwag" with Hewlett Packard
over a new HP PhotoSmart 2575 printer which I recently purchased. I spent
ages on their "chat to the support people" support line but I found it
difficult to get my point across to them. They just kept running me through
their "standard list of fixes" from their database, which of course are all
written under the assumption that the printer is fine and that it is the
user who is faulty! At the moment I'm in the position where my case has been
passed on to their local technical group and I'm waiting for them to give me
a ring (been waiting about four days so far!). I sent them some code to try,
and I know for a fact that their printer is definitely incorrectly reporting
its unprintable top margin when the printer is set to its "minimize margins"
mode. The problem of course is that all of the tens of thousands of HP2575
printers they've sold will have the same problem, which means they're not
going to be too keen to admit the fault! I've told them that all they have
to do is update the driver and make an update available on the web, but so
far I'm still waiting for the response from their technical people.
Anyway, I would appreciate it if you would tell me exactly what printer you
are using, and what special printer settings you are using (if any) and I'd
also appreciate it if you would run the following code for me and let me
know the result. The instructions in the code tell you to change the windows
default printer to the HP2575 before running the code, but of course you
should set it to whatever printer you are currently using.
The code is a bit "messy", but I had to write it so that the string printed
is actually contained in the code and I also had to add lots of comments
that will of course be unnecessary to a VB programmer but that the HP
support people would probably require (judging by what they said when I
talked to them!).
Please try to run this code for me Dale, and let me know the result. By the
way, if anyone else would like to try the code and report the result I would
much appreciate it, especially anyone who also has a HP2575 printer (taking
special note of the instruction to set its default settings in Control Panel
to the "minimize margin" mode before running the code).
Mike
Option Explicit
Private Declare Function GetDeviceCaps Lib "gdi32" _
(ByVal hdc As Long, ByVal nIndex As Long) As Long
Private Const PHYSICALOFFSETY = 113 ' Printers' top margin
Private Const LOGPIXELSY = 90 ' vertical pixels per inch
Private Sub Command1_Click()
Dim offsetYpix As Long ' variable to hold top margin value
Dim dpiY As Long ' variable to hold vertical pixels per inch
Dim offsetYinch As Single ' variable to hold conversion
Dim y As Long ' variable to hold y coordinate
Dim s1 As String ' variable to hold a message
Printer.Print ' open the current system default printer
offsetYpix = GetDeviceCaps(Printer.hdc, PHYSICALOFFSETY)
' at this point the variable offsetYpix contains the
' printer's current "unprintable top margin" setting
' in device units (printer pixels by default)
dpiY = GetDeviceCaps(Printer.hdc, LOGPIXELSY)
' at this point the variable dpiY contains the current pixels
' per inch resolution of the printer (300, 600 or whatever)
offsetYinch = offsetYpix / dpiY
Printer.ScaleMode = vbPixels ' set drawing scale to device pixels
y = 0 ' set y coordinate to very top of "printable ara"
' Now draw a thin "single pixel thick" line at a
' y coordinate of 0 (zero). This will produce a line
' at the top of the printer's current "printable area"
Printer.Line (0, y)-(Printer.ScaleWidth, y)
' now build a string to display to the user
s1 = "The following are the values currently being reported "
s1 = s1 & "to Windows by the default printer:"
s1 = s1 & vbCrLf & vbCrLf
s1 = s1 & "Current unprintable top margin (pixels) "
s1 = s1 & Format(offsetYpix) & vbCrLf
s1 = s1 & "Current vertical resolution "
s1 = s1 & "(pixels per inch) " & Format(dpiY) & vbCrLf
s1 = s1 & "Current unprintable top margin (inches) "
s1 = s1 & Format(offsetYinch, "0.00") & vbCrLf & vbCrLf
s1 = s1 & "Carefully measure the position of the thin "
s1 = s1 & "horizontal line from the top of the printed "
s1 = s1 & "page and compare it to the above value."
s1 = s1 & vbCrLf & vbCrLf & "Click OK to print the page."
MsgBox s1
Printer.Print: Printer.Print
Printer.Print s1
Printer.Print
Printer.Font.Bold = True
Printer.Font.Italic = True
Printer.Print "This program should be run after first using ";
Printer.Print "Windows control panel to set the HP2575 as the"
Printer.Print "default printer and after setting its default ";
Printer.Print "properties to 'Minimize Margins' in the printer"
Printer.Print "preferences under the 'Effects' tab. (Note ";
Printer.Print "that on some systems this might require "
Printer.Print "administrator privileges)."
Printer.Font.Bold = False
Printer.Font.Italic = False
Printer.Print
Printer.Print "On all HP 2575 printers I have tested the actual ";
Printer.Print "top margin reported by the printer driver to"
Printer.Print "Windows is 0.12 inches, but the top margin ";
Printer.Print "actually used by the printer is 0.07 inches "
Printer.Print "This causes all Windows applications to position ";
Printer.Print "everything incorrectly on the page when the"
Printer.Print "printer is in 'minimize margins' mode. For ";
Printer.Print "example, when using the HP 2575 in its minimize"
Printer.Print "margins mode all Windows applications will expect ";
Printer.Print "the above thin line to be at position 0.12 inches"
Printer.Print "on the page, but because of the driver fault ";
Printer.Print "it will actually be at position 0.07 inches."
Printer.Print "Everything on the page will be incorrectly ";
Printer.Print "positioned because of this fault (not just"
Printer.Print "things that are near the top)."
Printer.Print
Printer.Print "To fix this problem the HP driver needs to be ";
Printer.Print "modified to either actually use 0.12 inches"
Printer.Print "when in its 'minimize margins' mode or to ";
Printer.Print "alternatively report the value of 0.07 inches "
Printer.Print "to Windows "
Printer.EndDoc ' print the document (single page)
End Sub
.
- References:
- Feelin' left out of it
- From: Mike Williams
- Feelin' left out of it
- Prev by Date: Re: DISCUSSION: Security issues using Access database
- Next by Date: Re: Microsoft Word Bookmark Problem
- Previous by thread: Re: Feelin' left out of it
- Next by thread: Re: Feelin' left out of it
- Index(es):
Relevant Pages
|