Apple Event: May 7th at 7 am PT

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

how to batch convert Word files to pdf

How do I batch convert Word files to pdf using Automator

MacBook Pro, OS X Yosemite (10.10.2)

Posted on Mar 18, 2015 12:56 PM

Reply
31 replies

Mar 18, 2015 1:09 PM in response to 32alston

Add get specified finder items and add the folder which contain your word files

add get folder contents (check repeat for subfolders if necessary)

NOw add filter finder items with the rule: extension contains doc

add convert word to pdf


run the workflow


or better

add get selected finder items and then convert word to pdf

this will convert the documents that you have selected

Mar 18, 2015 6:37 PM in response to 32alston

Here is a drag/drop AppleScript solution that uses the command-line LibreOffice capability to convert MS Word (.doc, .docx) files into PDF. Drag/Drop a single file, or a folder of Word documents, and it will write the respective PDF back to the original file location. When it is done, an OS X Notification will slide out onto the Desktop and provide the count of processed files.


Save this AppleScript as a Desktop application that remains open after running. If you ignore the latter, the notification will not show when it is done. Tested on Mavericks 10.9.5.


property name_extension : {"doc", "docx"}

global fileCnt


on open of finderObjects


set fileCnt to 0


repeat with i in (finderObjects)

if folder of (info for i) is true then

tell application "Finder" to set temp to (entire contents of i)

repeat with j in (temp)

process_files(j)

end repeat

else

process_files(i)

end if

end repeat


display notification "Processed Files: " & fileCnt with title "Word2PDF" subtitle "Processing Complete"


end open


on process_files(fname)


set cmd to "/Applications/LibreOffice.app/Contents/MacOS/soffice "

set cmdArgs to "--headless --convert-to pdf:writer_pdf_Export --outdir "


tell application "Finder"

set nameExt to name extension of fname

set outDir to do shell script "dirname " & POSIX path of (fname as alias)


if name extension of fname is in name_extension then

try

do shell script cmd & cmdArgs & outDir & space & POSIX path of (fname as alias)

set fileCnt to fileCnt + 1

on error errorMessagenumbererrorNumber

display alert "Processing Error: " message "[ " & errorNumber & " ] " & errorMessage

error number -128

end try

end if

end tell

return


end process_files

Mar 21, 2015 6:35 AM in response to 32Mine

Don't add the word document files in the "get specified finder items" box. Only add the folder that contains them. If they are contained folder in folder structure then select "repeat for each sub folder" . In your case you just need to add the "CURRICULUM HANDBOOK" folder and there is no need to check the "replace for each sub folder found" option

how to batch convert Word files to pdf

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