Printing at max printer resolution

I remember reading about the ways to print at the max resolution of the printer a while ago (could be quite a while ago). Unfortuntaly, searches in the forum, even with Google’s help, were not fruitful.

As default, I get this:
g.width: 468
g.height: 648

When a basic 300 dpi printer should do 2250 x 3300.

How is that done ?

TIA

Hi Michel,

the only thing you‘ve to do before printing is set PrinterSetup.MaximumHorizontalResolution/MaximumVerticalResolution to -1 for the highest possible resolution of the output device.

Especially if this is about TargetWindows… Read the Notes of Printer Setup:

Back to Windows:
Since Xojo has implemented Direct2D, it will always return a virtual drawing surface at 96 DPI.
Which doesn’t mean that you can’t print at a higher resulution. Here’s a link to a Thread from 2017.

If I do recall well, I do set PrinterSetup.MaxHorizontalResolution (and vertical) to 300, then I check if PrinterSetup.HorizontalResolution (and vertical) >=300, If not I try the same with 600, if not -1. Then I use the resolutions I got to calculate my print space. 300DPI is enough for my jobs, I don’t want 1200+dpi for reports.

Thank you all.

I have to confess under Windows, I have not yet found the courage to move my apps to Direct2D. It would break too many things. I am still using 2016R3.

So all I had to do was to set PageSetup MaxHorizontalResolution and MaxVerticalResolution to -1, and I was in business :slight_smile:

This prompts me to ask the questions

  1. Why did that work?
  2. What did it do?
  3. What is the actual print resolution at this point?

You may or may not have the answers to these questions, but if someone does - I would like to know!

I’m on the same boat. I’ve chose the 2016r3 as the safest one and waiting to elect a new one since. 2019r1.1 looked promising but had few glitches like spreading htmlviewer subprocs and whatever, then came the API2 and seems R3.1 still have few things. Will wait 2020r1 now. :smiley:

[quote=472999:@Tim Parnell]This prompts me to ask the questions

  1. Why did that work?
  2. What did it do?
  3. What is the actual print resolution at this point?

You may or may not have the answers to these questions, but if someone does - I would like to know![/quote]

https://documentation.xojo.com/index.php/PrinterSetup.MaxHorizontalResolution (API1)

“You can change it to the maximum printer resolution you’re prepared to handle or -1 for the highest possible resolution of the output device. After calling PageSetupDialog, OpenPrinter, or OpenPrinterDialog, the HorizontalResolution property will automatically be set to the highest resolution supported by the printer driver”

Same for MaxVerticalResolution.

Thank you! I didn’t know it was right there :slight_smile:

Ah right… That has been changed again in 2018r2: <https://xojo.com/issue/51556>.
So current Xojo Versions should report and use a “real/effective value” again (if possible).

But the way I read and understand this for TargetWindows is that you might still get “96” in some cases, depending on the Printer Driver. And that doesn’t necessarily mean that you’re really limited to 96 DPI. It then would be this “virtual layout/drawing surface”, but still allow to draw higher resolution within that.

Somehow I think to remember that this could happen on other Targets, too. I guess it’s been a situation on macOS where you’d get 600, while the printer could do 1200 - but sorry that I don’t remember that good enough to back this up with links and facts, so I could be wrong…

So for example in case you want to print with at least 300 DPI, but get a lower resolution reported (96) - then it shouldn’t hurt to build a 300 DPI source and scale your 300 DPI source down into that “virtual drawing surface”. And in the best case, it’ll be printed just as you’ve expected. It certainly won’t even get the chance if you believe the max is 96 DPI and draw such a low-res graphics.
I hope I remember that correctly and it’s still correct nowadays :wink:

Which boils down to:

  • draw your source with the minimum DPI you really want/need (and not with 96, should Xojo report that back)
  • of course draw your source with the max DPI Xojo reports (if that’s higher than what you really need as a minimum)
  • scale it appropriately into the Printer Graphics you get (even if that happens to be a virtual 96 DPI graphics).

For reports, I made my own routines with my own virtual surface, even worse than Windows, I use 72 DPI but my routines use floating point coordinates calculate precise points in the virtual space like “32.234256, 27.5645645”. The math is done using what the driver returns, 300, 600, 1200, 96… I try to force starting at 300 (faster, smaller bitmaps) and adapt later. No need to scale.