Hi,
as the object says i’m trying (without success) to code a function in Xojo 2017r3 so that my program can print an invoice who look the same on Windows and Mac.
After hours and hours of trying i still don’t understand how i can achive that result.
I’m coding on OS X 10.13.3 and Xojo 2017r3 but i need to compile my app for a customer who only has Windows 7/10.
When i debug my app on my mac it looks like it should but when i compile it and run on a demo pc i have here in the office the print is smaller and out of position even if i’m printing on the same printer.
I read on the forum something about dpi but it is a little above my skill … could please someone help me in a more easy to understand way ?
What i do is something like that :
Dim ps As New PrinterSetup
Dim invoice as New Graphics
ps.MaxHorizontalResolution = -1
ps.MaxVerticalResolution = -1
invoice = OpenPrinterDialog(ps)
after that i do some Drawstring, PenHeight DrawRoundRect etc … just to place things where i want them to be.
is there a way to print so that the layout is the same in Windows and Mac ?
is not a font problem.
i have left and upper margin wrong. the size of a box is different. If i set the “correct” size for a box on mac is smaller in Windows. If i set it for windows when i print on the mac is bigger and so it goes out of the page
Left to the basics, Mac will give you a page of dots expressed in 72 dots per inch.
An 8 inch wide paper will be 8 * 72 dots across
Direct2D versions of Xojo on Windows, the page size is expressed in 96 dpi
An 8 inch wide paper will have 8 * 96 dots, which is why things print smaller
On both, a 2 inch square is 2 * (dpi) dots
If you ask for a higher resolution, you may get a page at 300 , 150, 600 , 360 dots per inch
Same rules apply
A 2 inch square at 360dpi is 720 dots across.
One common way to handle this variation is to design your code around a known page size , assuming 72 dpi, and use the multiplier to get the ‘right’ number of dots.
eg if your resolution comes in at 300, that dfFactor would be 300/72
PDF resolves this by always being 72dpi but by using doubles as co-ordinates.
There is ‘less than 1 pixel’ resolution in a PDF.