Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Bulk convert text files to PDF' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Bulk convert text files to PDF
Authored by: lsequeir on Jun 07, '11 07:46:08AM

Thank you! This is a great hint for anyone who needs to create pdf versions of many files.

Perhaps even handier in this situation (at least in Snow Leopard) may be to have this set as an Automator service.
This has two main advantages that I can think of: a) it is always readily available in the contextual menu, no need to locate an application to drag your file to; and b), the code for the service is actually shorter and simpler - for instance, there is no need to deal with text item delimiters at all.

Just create an Automator service, set to accept files and folders from the Finder; add just one action: "Run Shell Script" (it under "Utilities"), and set "pass input" as "as arguments". The code will be almost all written for you already. Just replace the placeholder "echo ..." line with the appropriate line.

If you prefer bash as your shell, you can use the following as the shell script (all but the second line will have been put there automatically):

for f in "$@"
do
/System/Library/Printers/Libraries/convert -f "$1" -o "${1:r}.pdf"
done


Or, If you prefer tcsh, you can use the following as the shell script (again, all but the second line will be there already):

while ( $# )
/System/Library/Printers/Libraries/convert -f "$1" -o "${1:r}.pdf"
shift
end

---
Luís



[ Reply to This | # ]