PrinterSetup: Different Results on Mac & Windows, Same Printer

Once again, I find myself struggling to put printed text in the same place on both Mac and Windows printers. I have one printer connected to both my Mac and my Windows machine, and it is the default printer for both systems. The code is simple:

[code]Dim ps as New PrinterSetup

ps.Landscape=False
ps.MaxHorizontalResolution = 300
ps.MaxVerticalResolution = 300[/code]

These are the resulting properties of ps on Mac, which have the correct PageLeft and PageTop values:

Height = 3058
HorizontalResolution = 300
Landscape = False
Left = 0
MaxHorizontalResolution = 300
MaxVerticalResolution = 300
PageHeight = 3300
PageLeft = -75
PageTop = -75
PageWidth = 2550
Top = 0
VerticalResolution = 300
Width = 2400

This is what I get on Windows, the PageLeft and PageTop are narrower than they are in reality:

Height = 3200
HorizontalResolution = 300
Landscape = False
Left = 0
MaxHorizontalResolution = 300
MaxVerticalResolution = 300
PageHeight = 3300
PageLeft = -50
PageTop = -50
PageWidth = 2550
Top = 0
VerticalResolution = 300
Width = 2450

The same thing happens if I use OpenPrinter or OpenPrinterDialog.

Is there a Windows declare that can get the correct info, or some accurate Xojo way to get it?

Thank you!

  • John

could be differences in the printer drivers?
differences in the underlying graphics library (Direct2D?)

seems that macOS is setting a 1/4" margin (which is somewhat normal)
and Windows is setting a 1/6" margin (which is very strange)

Definately a driver issue. Windows just does a better support for printers exposing all/most possible options. Apple obviously takes a conveniant/easy road taking more margin than necessary while most modern printers even support full page width printing.

What is the name (part # ?) / brand of the used printer ?

Margins or no, you still have what you need to print in the same place on each, unless you really want to hit that margin area.

Pageleft and PageTop tell you how offset the 0,0 position of the printable area is.

On Mac, it’s 75 pixels from the left
On Windows, its 50 pixels from the left

If you want to draw a 1/2 inch square, 1 inch away from the top left corner , it’s this code on both machines:

g.Fillrect   300 + ps.pageleft, 300 + ps.pagetop,150,150

If you dont account for the pagetop and pagewidth, your drawing is the same, but it may be offset to the right and down, depending on the printer.
You need to account for the margins if you intend to hit pre-printed stationery.

[quote=423697:@Jeff Tullin]On Mac, it’s 75 pixels from the left
On Windows, its 50 pixels from the left[/quote]

I just freaked a bit because I’m printing to sheets of Avery labels, and seeing the difference made me wonder if I was going to run into problems in the future. It sounds like I should just chill a bit…:slight_smile:

Thanks!

  • John