Minimum Printer Margins

Hello,

I want to print a rectangle on a page starting at x/y = minimum print margins. I can let PrinterSetup.PageLeft or PrinterSetup.PageTop run these back to me. This always returns a negative value. But that doesn’t matter, because I can convert it into a positive value with a conditional:

Dim leftMargin As Integer = PrinterSetup.PageLeft leftMargin = If(leftMargin >=0, leftMargin, -leftMargin)

This gives me the minimum edge of the printable area in pixels. To convert it to inches, I would divide it by 96 DPI (Xojo version >= 2017R1) or 72 DPI (Xojo version <= 2017R1).

Why I ask, I would like to properly align RBReportFields using BeforePrinting event.

However, I am not sure if my train of thought is correct. Are there any comments? How do I get the correct values?

leftMargin = abs(Printersetup.PageLeft)

Be careful, if you show a page setup dialog on Windows, the printer setup returned forces 1" margins, which means the unprintable area is 1" in from all sides - which isn’t the case at all. This unwelcome change happened in 2017 and persists now…:frowning:

Do you have any workaround for this?

Not really. You can choose to not show the page setup dialog, in which case you’re using a generic page setup whose page size may not be accurate.

I talked to William Yu about this at XDC, he was interested in getting it fixed, but I haven’t had time since I got back to put together a demo project to file a Feedback report about.