Create keyboard shortcut to export as PDF in Safari on OS X

Posted in Applications and OSX -

I frequently export a whole bunch of web pages as PDF documents in Safari on OS X and found it frustrating to have to use the mouse to click click click to do it, and worked out how to create a keyboard shortcut to do it much faster and simply.

tl;dr

System Prefences -> Keyboard -> Shortcuts -> App Shortcuts -> + -> Change application to "Safari" -> Enter "Export as PDF..." as the menu title (the dots are important) -> enter a keyboard shortcut and click "Add".

The longer answer with screenshots

When you print from any Mac app you'll see the print dialog with the "PDF" drop down box, as shown in the map below. Before I even realised there was an "Export as PDF" menu option in Safari, I was also going into the print dialog to export a heap of reports as PDFs.

exporting as a pdf from the print dialog in safari

There's a much easier way to do it; from the File menu in Safari, there's an "Export as PDF" option. Select that and you'll be prompted where to save the exported file.

export as pdf option in safari

That's still a little annoying when you need to export a lot of pages (like I need to every Monday morning, usually a dozen or so) because there's still a couple of clicks before getting the dialog to save the file.

So let's add a keyboard shortcut to Safari to make it much faster to export as PDF. Go into the System Preferences and click the "Keyboard" option:

selecting keyboard from system preferences

The select Shortcuts, App Shortcuts and click the + button as highlighted with the red boxes in the screenshot below:

add app shortcut

The next screenshot shows the dialog where you add the shortcut. The application drop down box will show "All Applications" by default, so open it up and select Safari. Then enter "Export as PDF..." in the menu title. This needs to match the title in the app exactly, so needs to include the ... at the end. Then enter a keyboard shortcut that isn't already used. Cmd+E worked for me, E for Export. Now click the "Add" button.

enter shortcut settings

Now we're back at the list of application shortcuts. There doesn't appear to be a way to change the application, but you can change both the title (if you cocked it up) or the shortcut keyboard combination (if you need to change it to something else) by clicking once or twice on the title or shortcut.

new shortcut is saved

Now looking back at the Safari File menu, we can see the "Export as PDF" option has the Cmd+E shortcut next to it. If it's not showing, then you've probably typed the title in incorrectly.

export as pdf with shortcut key

There may be other ways to do this, but I've never found it in Safari's preferences, so as far as I am aware it has to be done through the system preferences.



Related posts:


Comments