简体   繁体   中英

Batch convert .py (text files) to .pdf on osx

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?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM