As a follow up to the previous post, there’s a simpler way to achieve the same result by skipping the AppleScript and just using Automator. I’m going to assume you know the problem already from the previous post – this one will just contain the alternative solution.
The “Watch me do” action of Automator allows you to record GUI interactions as part of an Automator workflow and play them back at will. So, the alternative solution to creating a print to preview service for Firefox is to simply record such an Automator workflow and use this as an action. To begin with, create a service in Automator – this should be familiar from these posts – as shown in Figure 1:
One subtlety is that, if you save this service prior to setting the input to “No input”, the service will not be recognised as being valid unless you have some text selected, even if you subsequently change this setting and re-save the workflow. Now click the record button, then go through the actions required to open the current Firefox document as a PDF in preview, and finally hit stop recording. You should see something akin to Figure 2:
If you run this automator workflow, you’ll see that it works, but is slow. It can be accelerated by setting a few options as shown in Figure 3, and I suggest setting it to only work in Firefox rather than any application (not shown):
This can now be set up for a keyboard shortcut, as shown in the posts linked above. This yields a complete process for using a keyboard shortcut within Firefox to open the current page as a PDF in Preview.