Is it possible to program the page setup?

The pagesetup statement opens the page setup dialog where the setup can be amended manually. It would be great if it was possible to change the orientation and scale programmatically but it seems that this is not the case.

Those are both options in the printtopdf statement.

The printtopdf statement also has the option of printing, rather than making a pdf, so it should do exactly what you want to do.

Thanks Dave. The way that some of these options are hidden where you’d least expect them keeps life interesting :slight_smile:

Yes, we can control the page setup if we print to paper or pdf. However, what if you want your users to have the print dialog options available before they print?

I have a database that contains different print forms, at different sizes, mainly A4 and A5, but Pan X uses one master page setup for every form. Jim has already stated that this will not change, so OK, we need other methods. I am programming my forms to print to pdf files, but as mentioned, I keep running into cases where I want to set the page size ahead of time, then give the user the print dialog, so they can choose which pages to print, two-sided, and any other of the many settings available.

I tried using AppleScript to do Page Setup, but it doesn’t seem to be in the Panorama dictionary. I’m wondering if it could be added, which would then give us an easy way to do page setup before opening the print dialog.

Anyone know of any other way (other scripting languages maybe…) to control page setup in Mac OS, outside of an appliction?

You can of course use the pagesetup to display the Page Setup dialog.

There is no way to programmatically set the page setup in advance. The information in the page setup is private – Apple does not document this information, and does not provide any way to change it in a program or script. It certainly would be nice if they did, but I wouldn’t hold my breath at this point.

There are scripting programs that work by simulating clicks. That sort of program could do it, but that would be very fragile. If the position of any of the buttons in the dialog changed, it would stop working, possibly in a catastrophic way (i.e. automatically click the wrong button).

Thanks Jim, I was afraid it would come down to Apple’s limitation. Appreciate you explaining it to us!