Watch folder to convert Microsoft Word to PDF


#1

I have a rather lengthy automation that creates contracts automatically for me and I’m getting stuck at the very end.

Is there a way to have Hazel, Zapier, etc. watch a folder in my Dropbox and automatically convert Microsoft Word documents to PDF?


#2

Hazel can watch a Dropbox folder. If you install the incredibly useful pandoc, you could have Hazel trigger a command line operation to convert a DOCX file to a PDF.


#3

Here is a version with microsoft word:

Here is a shell script:

Here is a version with Calibre

Personal I like the method with calibre the most because you can very easily pass conditions for pagesize, pagenumbers etc to the pdf-version.


#4

Hi everyone,
Thanks for all the ideas!
@sylumer: I wasn’t sure how to get pandoc to work, it never seemed to show up anywhere on my computer after I installed it.

@E_Thelonius: The AppleScript kept giving me errors when I used this script, and I couldn’t figure out why. The shell script worked except the formatting of my document changed for some reason when it converted to PDF. I can’t say I understand why that was happening. I’m still experimenting with Calibre since I’ve never used it before.

Thank you so much for all the advice!!


#5

I take it back! I gave the AppleScript another attempt, and it worked perfectly!


#6

For info - getting started with Pandoc page on the Pandoc web site.

It is a command line tool. It should show in finder, but you would always trigger from the command line.


#7

Good – did you change anything? Because another user said it did not work for him, and maybe it is the same issue.

The good thing with calibre is, that it does not has to be open and is not opened with the script. The script uses a command line tool of calibre so you never have to open it or understand how the user interface of calibre works (but it is nevertheless worthwhile a look). The bad thing is, that, like the shell script, it just graps the text and all the other conditions like page size and page numbers have to be set within the script. So if you have very different conditions for different word files you should stick to the apple script.


#8

The strange thing is that I didn’t change anything to get the AppleScript to work. I just copied and pasted it back in after trying a few different things, and that time it asked for all the proper permissions and took care of everything properly.


#9

Thanks for the good tips on solving this one

I have also tried to find good solutions multiple times over the years but failed to be totally happy with the end results. I have full Adobe CS -suite and once again spent this morning trying to figure out how to use tools I have with Applescript to get job done and failed. As I am not willing to install Office suite so had to try something Else.

Tried again with pandoc, but could not figure out how to get all required components/fonts? installed for making it work with all different docx files people keep sending me. Some of them will give problems with fonts or something else that tex/latex software-sculpture do not know how to handle, so failed again with that.

After seeking third party converters for the task, I found this very automation friendly cloud service https://cloudconvert.com. It supports Dropbox folder triggers out of the box that allows you to simply drop annoying docx, pptx … files to folder for conversion. It also has nice CLI interface for shell scripting usage not to mention rich API for web-service purposes.

It is paid service with multiple options how to pay for each conversion. I chose 500 minutes prepaid package at the cost of 7€ (exl tax) that will allow me to do about 500 conversions. There is also free tier of 25 conversions, but it lacks the Dropbox folder watch that I wanted to have.

For me this will do the task. Hazel will now take all docx and pptx -files from my Download folder to conversion folder and return them once converted back in more usable format.