My print to pdf routine is working fine, using the printtopdf statement, but if I call it with 2,000 records selected, it dutifully prints them. The problem is that the Cancel button is completely unresponsive, and that many pages can take several minutes.
You could easily implement a “Do you really want to save a PDF for 2000 records?” dialog into your procedure.
Yes, I have done that in the past to catch mistakes. But I’m wondering if the Cancel button could be made functional.
I think that the problem is that once it is sent to Apple’s printing system, it is under Apple’s control, and Panorama cannot stop it.
Depending on the printer and its software you might be able to access its print queue and cancel printing via it (admittedly working outside of PanX) once you realized something other than intended had been sent to the printer.
The printopdf statement is based on an API for creating a PDF file. It turns out this API can also be used to print directly, but that’s really not what it is designed for.
Really, the proper way to print is using the print statement. However, that statement doesn’t offer any automation capability in terms of specifying the printer, page orientation, number of copies, etc. All of those options have to be specified manually. Apple really doesn’t seem interested in supporting automation of printing. It turns out the PDF API does allow some automation, but it’s really not designed for general printing so it does have some drawbacks, like not being able to cancel once it has started.