Report Printing Margins

I have been working with a data-entry application and now I am adding a report printing feature. Given it is a simple report, it was easy to create. It prints exactly as intended on my Mac.

However, on Windows, the Printer Setup always defaults to one inch margins on each side and will cut off a fair bit of the content. If I set the margins to 0 in the printer setup dialog, all of the content is printed.

The question of the moment – is there a way to programmatically set the margins to “0” in code? Right now. I hope the end-user remembers to change the margin every time they load the application and print the report. I have a MsgBox reminder that pops up if running on Windows just before the Printer Setup dialog is shown.

I’ve looked at the PrinterSetup properties PageTop, PageLeft, PageHeight, and PageWidth, but they are read-only. I’d like to explicitly set those values. How do I bes handle this situation? Below is the code I am using to print the report.

Dim rs As RecordSet
rs = app.db.SQLSelect("SELECT [....] FROM [...] ORDER BY [...] ASC")    'Query redacted for public posting

If rs = Nil Then
  MsgBox "There is no data in the recordset. Printing Cancelled"
Else
  
   Dim ps As New PrinterSetup
  #If TargetWindows Then
    MsgBox "Reminder that you must set your top, bottom, left, and right margins to '0' for correct printing in the Printer Dialog."
  #Endif
  Dim rpt As New rptHistory
  ps.MaxHorizontalResolution = 600
  ps.MaxVerticalResolution = 600
  If ps.PageSetupDialog Then
    Dim g As Graphics
    g = OpenPrinterDialog(ps,Nil) 
    If g <> Nil Then
      Dim Rsq As New Reports.RecordSetQuery(rs)
      If rpt.Run( Rsq , ps ) Then 
        rpt.Document.Print(g) 
      End If
    End If
  End If
End If

Also, I’ve noticed that printing is much lower resolution on Windows, versus Mac even when printing to the exact same printer. I thought the low resolution printing was addressed with the recent Direct2D Printing APIs.

For reference, I am using Xojo 2017 R1. The Mac machine is running macOS Sierra 10.12.4. Windows machine is Windows 10 Pro Version 1607 Build 14393.953.