PrintToPDF and double sided printing?

I’m attempting to use the printtopdf statement to print directly to my default printer. For default printing, it works great.

I would like to set the “2 sided” option to on so I can print on both sides of the paper. is there an option to designate this using printtopdf?

Also - a procedure with:
pagesetup
print dialog

doesn’t print - but the page setup dialog does appear.

a procedure with:
print dialog

prints just fine - the dialog pops up, I can select desired options and click “OK” to start printing.

Is there some reason the print dialog statement is not executed following a pagesetup statement…? Given that it works fine alone…?

Sorry, no. Only standard Apple options are supported. Two sided printing is not an Apple option, but rather an option provided by your printer driver, so there is no API available to control that. (In other words, it is not possible for ProVUE to control this option. If it was possible, I would add that – I’ve also got a printer with the 2 sided option!)

This is a known bug with the print related dialogs. For some reason, these dialogs (which are generated by Apple’s code) stop the execution of Panorama code. The same problem occurs with the print dialog statement, any following code does not run. I have not been able to figure out how to work around this problem.

Am I to understand from this thread that you can not do 2 sided printing with Panorama X? I don’t have a printer that can test it.

But you can easily print to Preview or Acrobat which do have 2-sided printing capability. If you know how to use Applescript (I don’t), you could probably embed an Applescript widget in a PX program to automate it.

I will experiment with the Applescript idea - thanks!

I’m not sure… but… if I put

 pagesetup
 beep

in a procedure, the beep sounds while the Page Setup dialog box is still displayed (before I click “OK”). This implies that the app isn’t trapping the “visible dialog” state and waiting for either “OK” or “Cancel”. The procedure appears to simply go on to the next statement…

If I put

pagesetup
beep
local startTime
startTime=now()
loop
    nop
until now()>startTime+10
print dialog

in a procedure, I get the page setup dialog, hear the beep, then get the spinning beach ball for 10 seconds - before I am able to click the “OK” button on the original dialog box - but, as confirmed earlier, no print action.

The buttons in the Page Setup dialog don’t respond until after the procedure loop has finished and the spinning beach ball disappears.

This seems to imply (confirm?) that the application has not stopped to wait for a confirmation “OK” or “Cancel” before going on to the next line of code in the procedure when the “pagesetup” statement is called.

If the Apple page setup dialog is stopping the procedure, how is the beep sounding? How is the beach ball appearing for exactly 10 seconds (the loop) before I am able to click “OK” in the Page Setup dialog?

No, you are not. You can print 2 sided all day long, but you have to do so by picking that option with the print dialog. As far as I know, you cannot do 2 sided printing using the printtopdf statement.

Two-sided printing does not make any sense in a PDF document as printing is not a property of a PDF. Two-sided printing is tied to your printer and is selected when you print a PDF or any document. I see where you are going with this, but it is not something you can do. I can think of some unusual scenarios requiring your user to flip pages on a one-sided printer that they might not like.

Except perhaps if you have that as the active preset in the printer before you print. There seem to be things like that in Mojave’s printing system, which I have not entirely come to grips with, and I have run into some issues with duplex printing.