问题
I teach a python course and have a large number of .py files that were submitted for an exam. I would like to convert all these to pdf so that I can open them in IAnnotate on my ipad, mark them up and return them to students. How can I do a such a conversion in batch mode?
回答1:
Tried on Mavericks:
#!/bin/bash
for file in *.py; do
textutil -convert rtf -font 'Courier New' -fontsize 9 ${file} -output ${file}.rtf
cupsfilter -D ${file}.rtf > ${file}.pdf
done
The resulting files will be named *.py.pdf.
来源:https://stackoverflow.com/questions/22119484/batch-convert-py-text-files-to-pdf-on-osx