Scaling when printing

I have read a few posts about scaling font size, x, y locations, and other settings when printing, based on the printer resolution.

Do you scale the top and bottom margins by the vertical resolution?

And then scale left and right margins by the horizontal resolution?

Since printer gets the max resolution for vertical and horizontal… are those every DIFFERENT?

I have to set the overall resolution on my report and was just going to use one or the other but started wondering if that works or not.

Have a read of https://forum.xojo.com/16419-print-works-fine-with-printer-but-not-pdf/p1#p135922
Covers a LOT of this

[quote=136750:@Tim Turner]Do you scale the top and bottom margins by the vertical resolution?

And then scale left and right margins by the horizontal resolution?
[/quote]
No. The margins as reported by PrinterSetup are already in terms of the resolution.

[quote]Since printer gets the max resolution for vertical and horizontal… are those every DIFFERENT?
[/quote]
They are usually the same, but they can be different. Code defensively.

[quote=136838:@Tim Hare]No. The margins as reported by PrinterSetup are already in terms of the resolution.

They are usually the same, but they can be different. Code defensively.[/quote]

All Canon jet printers have rectangular pixels, for instance.

One of my issues is that I am using Turboreport.

It does internal scaling of font size. You set resolution when you create the report.

Problem is on a mac the text prints blurry like its 72dpi even if I scale it by printer resolution.
If I set the report resolution to 144 dpi it prints the text not as blurry but also too big for the page and
it goes off the page and is a big font size.

The same code on windows works fine so I am baffled.

Anyway in a real bind here… can’t figure this one out.

One thing I figured out is if I do this on mac:

Dim p as PrinterSetup

p=New PrinterSetup

'set current resolution to MAX - 2014.7
p.MaxHorizontalResolution = -1
p.MaxVerticalResolution = -1

MsgBox “Horiz resolution=” + Str(p.HorizontalResolution)

It shows “72” as the resolution but I thought the -1 code set resolution to the max?
The printer supports 1200dpi so 72 cannot be the max.

Without calling a PageSetupDialog I do not see a way of getting around your resolution issue.

I modified your code a bit:

[code] Dim p as PrinterSetup
p=New PrinterSetup

'set current resolution to MAX - 2014.7
p.MaxHorizontalResolution = -1
p.MaxVerticalResolution = -1

MsgBox “Horiz resolution=” + Str(p.HorizontalResolution) + EndOfLine + EndOfLine + “SetupString=” + p.SetupString

if p.PageSetupDialog Then
MsgBox “Horiz resolution=” + Str(p.HorizontalResolution) + EndOfLine + EndOfLine + “SetupString=” + p.SetupString
End if[/code]
If you look before and after you will see the resolution is updated. Also you can save and reuse the SetupString to retain settings going forward.

OK I get it now. Thanks for the tip… I will try it out!

It keeps popping up the page setup dialog over and over and never gets to the MsgBox that pops up the resolution.
Very weird.

Also the Setup string is so long it runs off my screen and there is no way to close it so had to remove that part of the code.

You should only use the PageSetupDialog only once and just keep the PrinterSetup in a property to be reused.

Resolution is set when you open the printer.

OK I understand… but why would an if statement keep popping the dialog up over and over.

if ps.PageSetupDialog Then
MsgBox “Horiz resolution=” + Str(ps.HorizontalResolution) + EndOfLine '+ EndOfLine + “SetupString=” + ps.SetupString
app.PrinterSettings = ps.SetupString
End if

When i run my app and print and it gets to this code… I can click cancel or print and it just keeps popping up the dialog over and over again. I have to force quit to get out of it.

This calls the page setup dialog and returns a boolean.

if ps.PageSetupDialog Then

You should only call it once then save your page setup. If it is popping up over and over then you are calling that section of code over and over.

http://documentation.xojo.com/index.php/PrinterSetup.PageSetupDialog