I have a (HP Deskjet) printer connected to a networked computer. I run my app on this computer and print 2 coordinate axes and a number of cross-shaped marks labelled with small tags next to them. If I then run the app from another computer in the net and send the output to the same printer, the printed sheet has the y axis reversed, i.e. everything is ok except that the vertical coordinate y has been changed to -y.
Any ideas why this is happening?
Last edited by krtxmrtz; Dec 16th, 2003 at 01:34 PM.
The only difference I could spot was, the printer that prints ok had the paper size set to Letter whereas the one that inverts the y axis had A4, but that shouldn't (and actually doesn't) make any difference.
This is as far as the properties button in the printer common dialog goes, I don't know if there's any "hidden" property that could be inspected elsewhere...
are you sure the printer drivers are exactly the same version on the two machines? It still shouldn't be doing what you're seeing, but that is something to look for.
OK guys, you're right, there ARE a few differences.
The computer that is printing correctly:
WinNT in English
Driver version: 4.01
The one that's printing y inverted:
Win98 in Spanish
Driver verision: 4.00
Still, why would this happen at all? I don't know what to do... The end user should be able to run this app in any windows environment no matter the printer driver he/she has...
Last edited by krtxmrtz; Jan 17th, 2003 at 03:22 AM.
There may be some locale setting difference as well, for example the "ThousandsSeparator" is different in English (",") and German ("."). There may be some other regional setting that affects the way your program is printing.
Have you tried setting the locale on the Spanish machine to English and then running your program?
Last edited by seaweed; Jan 17th, 2003 at 12:19 PM.
(BUMP)
The last post on this thread dates from January and at the time I had to finally lay the project aside as I could find no explanation.
Now I'm tackling it afresh and have found this puzzling fact. I've run once again the code in my home pc and, whereas the compiled code performs as expected, the y-axis is still inverted when the code is run from the IDE. I suppose this rules out any cause related to regional settings. Still I'm clueless.
send me the code or what not, and I will test it on My printers running it across the network, and let me see if it prints correctly on my printers....
Attached is the backbone of my printing code. It reproduces the problem of inverting the Y axis on some printers. Also try to print with the code without and with compilation.
What it does is printing the X and Y axes along with a few marks at specified coordinates. You may want to set the printing options to black and white.
What I'm confused here on is you say it prints "a few marks on the x and y axes". Every printer I've ever worked with in VB the X axis is the top border of the page and the y axis is the left boder of hte page. So 0, 0 is the top left corner of the page.
Is there some setting or something somewhere that you changed to make it so 0,0 is the center of the page? Thats the only way I could figure you'd be getting a -y value and still be able to see it.
Originally posted by StevenHickerson Every printer I've ever worked with in VB the X axis is the top border of the page and the y axis is the left boder of hte page. So 0, 0 is the top left corner of the page.
You're right, that's why I have defined my own coordinate system (take a look at the code):
VB Code:
Printer.ScaleMode = vbMillimeters
pw = Printer.ScaleWidth
ph = Printer.ScaleHeight
Printer.Scale (-pw / 2, ph / 2)-(pw / 2, -ph / 2)
This sets the origin at the center of the page and, in principle, the x axis pointing to the right and the y axis pointing up. The problem is some printers do it as intended but others invert the y axis.
Hrmmm, Ok so you scaled the printer in order to get this type of coordinate system. My next question then would be.. why in the heck would you want this lol? If its for printing things a certain way a few math equations could simulate this coordinate system with the normal system.
And then you wouldn't have to worry about your y value being inverted on some printers =p
Originally posted by StevenHickerson Hrmmm, Ok so you scaled the printer in order to get this type of coordinate system. My next question then would be.. why in the heck would you want this lol? If its for printing things a certain way a few math equations could simulate this coordinate system with the normal system.
I'm used to thinking in terms of a "normal" coordinate system as used in math and physics. After defining the printer scale it should work anyway. The funny thing is different printers interpret the scaling differently. Also why on earth the y axis is inverted after compilation?
I dont know the answer to why it happens But I do know if you just use a function to return the coordinates into a regular printer coordinate you shouldn't have a problem.
For example
VB Code:
Function XConCoord (X As Double) As Double
XConCoord = (Printer.ScaleWidth / 2) + X
End Function
Function YConCoord (Y As Double) As Double
YConCoord = (Printer.ScaleHeight / 2) + Y
End Function
You could then work with numbers as if you were working with the system your scaling to just pass the numbers through these functions and you will be converted over to a normal printer coordinate.
Doing this you shouldnt have a problem with the Y being inverted. I can't reproduce the inverting on my 3 printers here at my house to figure out why your getting an inverted Y-Axis.
I may end up doing as you suggest but it's somewhat cumbersome having to transform every single coordinate, even if it amounts to just adding a number, especially when there's a lot of stuff to be printed. Moreover, the Printer.Scale method is supposed to be there precisely to avoid having to go through all that trouble.