Blank page in my printer

This line (the only one in an application) produces a blank page in my printer.

Var g As Graphics = PrinterSetup.OpenPrinter(New PrinterSetup)

Is there a way to prevent this blank page?

When the method ends, g goes out of scope and that’s how you complete the last page when you’re printing. Since you’re not drawing anything, you get one blank page :slight_smile:

Edit: So to prevent this behavior, don’t open the printer until you’re ready to print.

That’s what I feared.
I open the printer because I need to know the paper dimensions.
If for any reason I need to cancel the printing, then I get this blank page.
It’s a pity that Xojo doesn’t detect a single blank page and eliminate it.

[quote=481115:@Ramon SASTRE]
I open the printer because I need to know the paper dimensions.[/quote]
You can get the paper dimensions form PageSetup. Is there a reason you aren’t?

Anyway, you are right Tim.
I can get all the information I need with the PageSetup and then if I have to cancel the printing I have no blank page because I didn’t open the printer.