Selecting a printer

I’m relatively new to Xojo (using an iMac with OSX 10.10.3). I have a problem with how to select a second printer that is not the default printer. This second printer uses a special size of paper. Having trawled through every forum conversation on the topic of printer setup it seems I’m not the only one with this problem.

I started with the following example code:

Dim g As Graphics
Dim ps As PrinterSetup

ps = new PrinterSetup
call ps.PageSetupDialog
if ps <> nil then
g = OpenPrinterDialog(ps)

Then I realised, when running it, that the page setup was for the default printer, which doesn’t include the special page size I need to select. But I can’t do the OpenPrinterDialog first because it needs a page setup.

Surely I need to select the printer first and then select the page setup afterwards. How can this be done? Am I missing something?

do not use call ps.PageSetupDialog - clicking Cancel still open the next window

you can select the Printer and Page Size in both Windows
The settings of the first window are transferred to the second window

(main is my Window)

[code]Dim g As Graphics
Dim ps As PrinterSetup

ps = new PrinterSetup
if ps.PageSetupDialog(main) then
if ps <> nil then
g = OpenPrinterDialog(ps, main)
if g <> nil then
// print code …
end if
end if
end if[/code]

Thanks Axel.