I just installed lastet XOJO version and in some of the computers where my desktop app is working, the printed data size has been reduced.
Everything sent is correctly printed, but in smaller size, maybe 40% smaller.
This started happening after installing new XOJO release.
Any clue why this is happening?
windows 7, 8 and 10
only thins printed via Xojo
I always do the same printing instructions:
[code] Dim p As New PrinterSetup
p.Landscape = True
g = openPrinterDialog§
if g = nil then
g.textFont = “Arial”
g.foreColor = rgb(0,0,0)//black
pageLength = (560)//the number of lines that can fit on the page
//NB. this will vary according to the size of paper in the printer
lines = 2
g.textSize = 14
renglonCursor = 50
if localCntr2 <> 0 then
lines = 26
g.bold = true
g.DrawPicture App.logoMain,30,renglonCursor - 12,50,50,0,0,530,530
g.textSize = 12
g.DrawString App.econtrolNombreEmpresa, 130 ,renglonCursor
g.bold = False
I’m guessing you have always received a page at 72dpi in the past.
You do not seem to be checking the dpi of the graphics here, or checking the page size.
pagelength may vary according to the paper size, but this code is not checking what it is ?
So if your code works for a 72dpi page, and you suddenly start to get a graphics object with 144dpi or higher, your text and pictures will be smaller on the page.
If you assume the right size of a square is 100x 100 at 72dpi
You need to adjust for what you actually get:
factor = g.horizontalresolution/72
square = (100 * factor) x (100 * factor)
Jeff thanks for the reply.
but, i cannot get to solve the situation.
i´ve been playing with the MaxHorizontalResolution and MaxVerticalResolution, but they make no change at all in print output.
i understand your post until the “if you assume”, after that i just dont get it, the “factor” and “square” are just not clear to me.
i get the following string when i get the printerSetup.SetupString:
i can change the
but as i said, no change on the output.
In the past, you have been given a graphics object where the resolution was 72dpi
72 pixels x 72 pixels = a square of 1 inch
Now, you are getting a graphics object where the resolution is 96 dpi
Now, it takes 96 dots to make an inch.
If you continue to assume that it is always72 dpi , and that you can get 560 lines on a page, your sizes will be incorrect on some, if not most printers.
72 x 72, will not be an inch square any longer. It will be smaller.
The amount it is smaller BY is 72/96 on this device.
So everything is 75% of the original size, unless you do something about it.
(If the printer gave you a graphics of 300dpi, it would be even worse.
Your 72 x 72 square would measure 1/4 of an inch on each side.)
Try playing with the Scalex and scaley properties before you start drawing.
eg (untested… this scaling may cause the opposite effect…)
g.scalex = ActualHorizontalResolution/72
g.scaley = ActualVerticalResolution/72
Thank you Jeff,
I´ve tried multiplying and dividing scaleX and scaleY in many ways but output is still the same.
Seems i have to change whole printing code to get the same size i used to get printed, print everything bigger…
Reprograming all of the printing methods wil take many days.
Any other idea?
Yes, it might. But I guess it will take you 2 hours tops.
Maybe start by creating a variable called
myscale as double
myscale = ActualHorizontalResolution/72
Then multiply all positions and sizes by ‘myscale’
g.drawrect 20 * myscale, 15 * myscale, 100 * myscale, 150 * myscale
To test what Jeff is saying, simply print a box that is 72 wide x 72 tall, if it is an inch on your printed page your resolution is indeed 72 dpi. If not, it’s something else.
Also, where are you actually forcing the DPI? I only see that in your printer set up string, which is not editable on its own. I would suggest that you do this here:
g = openPrinterDialog§
if g = nil then
p.MaxHorizontalResolution = 72
p.MaxVerticalResolution = 72
This effectively overwrites the value that is returned by the printer setup which can be modified in the printer dialog settings. If you are requiring a specific DPI then you must do this.