Create a service to print selected text in OS X

AutomatorIconXIf you have used Windows systems you might have found its ability to print a selection of text to be rather useful, and may wish for this feature to be in OS X. Unfortunately, Apple does not have this as an option by default; however, Apple does support the creation of custom services using Automator, and if needed, you can make one that will allow you to do this, and then bind it to a hotkey so you can quickly invoke it.

  1. Open Automator and create a new Service workflow, and then ensure the input at the top of the workflow is “text” from “any application.”
  2. Locate and drag the “New Text File” action to the workflow area, and have it save the input as a file with a unique name (e.g., “tempFile.txt”) in the “Downloads” folder (or another folder of your choice).
  3. Drag the Print Finder Items action to the workflow area below this first action.
  4. Drag the “Move Finder Items to Trash” action as the last one in the sequence.

When this is done, save the entire workflow with a name like “Print Selected Text,” and it should now be available in the Services submenu of either the Apple menu, or the contextual menu, when you select some text in a document.

Print selected text service in OS X

Create a service workflow that looks exactly like this, and you will be able to trigger it on selected text to print only the selected text.

While the Services menu will hold the workflow, by setting a hotkey to invoke it you can make it far more convenient. To do this, go to the Shortcuts tab of the Keyboard system preferences, and select the Services section. Then scroll down in the list of services to the “Text” section (since you had set the service to accept text in any application), and then locate the new “Print Selected Text” service.

Selecting the service in this list will reveal an “Add Shortcut” button, which when clicked will allow you to enter a hotkey of your choice for the service. I recommend you use something like Control-Option-Command-P, since these modifier keys are all in-line and easy to press, and are likely not used by most other applications so the chance of conflicts from hotkey overlap should be minimal.

When done, go to a program where you can select text, highlight a selection, and then press the hotkey or choose the service from the Services menu to print the highlighted text.

11 thoughts on “Create a service to print selected text in OS X

  1. George

    Please allow me to point out a limitation : to be printed, the text must be in one block. If there is a paragraph, no print.

    1. tingo

      Sorry, George, I don’t quite agree there. In TextEdit, it works fine for me. However, if I make several selections within a document (by holding Cmd while dragging the mouse), it prints them right under each other (like: it hasn’t noticed that there were paragraph in between, because it never received the print command for such). But in Tex-Edit Plus, it acts as if the paragraph didn’t exist, i.e. it prints what’s coming below stuck to what’s on top, without even a space. So things seem to vary according to the application, according to how_it_ treats paragraphs internally.

      I find neat that it enables you to print the selected names of (single, unfortunately) items, such as, say, the name of a single file in the Finder, or the title of a single podcast in iTunes.

  2. tingo

    Topher: a neat feature, thanks, but the printouts are slightly primitive. Is there a way to retain the original document’s formatting (fonts, styles etc.) and to set up some margins, or at least to force this service to access the standard Print dialogue with all its features before running off to the printer?

  3. Ephraim Fithian

    When creating the service, in New Text File, choose rtf rather than Same As Input Text. This gives a nicely formatted result. Now how to choose the font….. Ideas?

  4. Ephraim Fithian

    When creating the service, choose
    Service receives selected rich text in any application
    New Text File use Rich text (rtf/rtfd, convert if needed)

    This allows selection of graphics as well as formatted text to be printed, in the original font.

    1. tingo

      Thanks, Ephraim. Works fine in 10.9.4, but not in 10.6.8 (incompatible versions of workflows saved by Automator, apparently)


Leave a Reply to Ephraim Fithian Cancel reply