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

独自空忆成欢 提交于 2019-12-10 19:24:55

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!