在 Linux 中将文本转换为 pdf 的轻量级解决方案
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20129029/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-07 01:25:12 来源:igfitidea点击:
a light solution to convert text to pdf in Linux
提问by Xin Guo
I am looking for a light solution in linux, to literallyconvert a *.txt
file into pdf
format. I hope the solution satisfies:
我正在 linux 中寻找一个简单的解决方案,从字面上将*.txt
文件转换为pdf
格式。我希望解决方案满足:
- lightweight. I know renaming
*.txt
to*.odt
and then uselibreoffice
is a pathway, but it will load the heavylibreoffice
. - I know
pr|groff -Tpdf
is a solution, yet it does not work literally: it throws away my line-breaks, an may accidentally eat some special marks as escaped labels, making potential bugs. But I still hope to use these old tools as much as possible, because they are stable and fast.
- 轻的。我知道重命名
*.txt
为*.odt
然后使用libreoffice
是一种途径,但它会加载沉重的libreoffice
. - 我知道
pr|groff -Tpdf
是一个解决方案,但它实际上并不能正常工作:它会丢弃我的换行符,可能会不小心吃一些特殊标记作为转义标签,从而产生潜在的错误。但我还是希望尽可能多地使用这些旧工具,因为它们既稳定又快速。
Many thanks!
非常感谢!