简体   繁体   English

在osx上批量转换.py(文本文件)到.pdf

[英]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. 我教python课程,并提交了大量提交给考试的.py文件。 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. 我想将所有这些转换为pdf,以便我可以在我的ipad上的IAnnotate中打开它们,标记它们并将它们返回给学生。 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 . 生成的文件将命名为*.py.pdf

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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