Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

"save as PDF' under print command, from Finder

Hi,

I know of and use a lot the "save to pdf" command under the print command.
I actually managed to give this a shortcut, which makes it even easier to use. (Systemcontrolpanel > keystrokes > all programs > "save as PDF" - ⌘P (it's that simple!! 😇)


But, what I really want is to give a command from within the finder that does the same as printing a file from within the Finder with "⌘ P"

I was thinking of Applescript or Automator or a combination, but I am not accustomed with either.

And I have been searching for this on the net but cannot find anything.


Still, it would be very handy to translate large amounts of documents to PDF. (paperless office)

iMac, macOS High Sierra (10.13), 2.7 GHz intel i5 core 27 inch

Posted on Dec 17, 2017 8:33 AM

Reply
3 replies

Dec 17, 2017 3:16 PM in response to Jo!

That is the PDF Services menu. It will convert whatever you are printing into a PDF and then do something with it. In the case you describe, that "something" is Save it.


Printing from the Finder opens the app that is set as default for the file type and prints it. It never gets to the "convert to PDF" stage.


The OS doesn't convert the file to a PDF because it has no idea how to interpret the file data. The App that understands the file data will raster the page to a printer "description" which is then printed. Instead of printing the rastered image, the items of the PDF Services menu use the raster data to render it as a PDF.

I don't know how an AppleScript or Automator workflow would bridge that gap. You would have to write the code such that it opened the default application and instructed it to convert to PDF. That function will be different for most apps, and I don't think there is a way to tell it to print to the PDF service. It may be possible, but I don't know how.


You would really need a third-party app that understands most file types so that it could render the data appropriately into a PDF.

Dec 17, 2017 4:21 PM in response to Barney-15E

what you describe is probably what goes on behind the scenes 😊 and I follow what you write.

The rastering is a strange one, for it 'writes' readable and selectable text … 🤔

Still, it is a command that is recognised by th e finder and the system and it works systemwide (how else could I add a key-stroke from within the system?)

Maybe I think too simple for this: if the system can do this (keystroke) why would it be so difficult to recognise the command as a command in automator or applescript?

I am not interested in the process, but only in the effect of the command.

Dec 17, 2017 6:48 PM in response to Jo!

I only explained the process to highlight the difficulty of making it happen. The OS cannot, on its own, convert a file of any type into a PDF. The program designed to manipulate the file would have to do that.

The OS doesn't necessarily read and write text. It hands that off to a process that can handle it. Whether that is an app or a background process, it still must be rastered into printer commands. It doesn't send a capital "W", then a lowercase "h" followed by a lowercase "y" to the printer. It would have no idea what to do with that.


Office came with Automator Actions that would save an Office document to PDF, so those would be possible.

why would it be so difficult to recognise the command as a command in automator or applescript?

Recognize what command? The command to turn it into a PDF? Well, you would have to tell the default program to turn it into a PDF.

When you Print in the Finder, it calls the default program and tells it to print the document. You cannot intercept that print command to push the save as PDF command on top of it.

Therefore, you would need to create your own commands to tell the specific default program to Print, then use the Save As PDF command. This could be done with UI scripting in AppleScript, or possibly Watch Me Do in Automator, but you would have to parse out which program opens what file type and either tell it to convert to PDF or Print, then click the Save As PDF command.


You can create an Automator Service that gets Files in the Finder, then run your "convert to or print then save as PDF" algorithm. You could give that Service a shortcut. While you may have collected all the underpants, you still need to flesh out Phase 2 in order to Profit.

"save as PDF' under print command, from Finder

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.