简体   繁体   中英

How to print text file to PDF file in Linux command line

I have some Python source file that I would like to print to PDF for later reading I used to do this with gedit, file by file but there are a large number of .py file I would like to automate this process

How can I do this ? Better with Syntax highlighting too, such as with gedit

Thanks in advance

我将使用a2ps很好地将其格式设置为Postscript,然后使用ps2pdf(来自Ghostscript)将Postscript转换为PDF。

使用此单个命令

$pandoc -o output.pdf input.py

you might encounter Problems with eg Umlaute (ÄÖÜ) or ß. If so, I suggest wkhtmltopdf as described here .

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