在Linux中将文本转换为pdf的简便解决方案 [英] a light solution to convert text to pdf in Linux

查看:101
本文介绍了在Linux中将文本转换为pdf的简便解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Linux中寻找一种简便的解决方案,以从字面上看*.txt文件转换为pdf格式.我希望该解决方案能够满足要求:

I am looking for a light solution in linux, to literally convert a *.txt file into pdf format. I hope the solution satisfies:

  1. 轻巧.我知道将*.txt重命名为*.odt然后使用libreoffice是一种途径,但是它将加载繁重的libreoffice.
  2. 我知道pr|groff -Tpdf是一种解决方案,但实际上并不起作用:它会丢弃我的换行符,可能会误食一些特殊标记作为转义标签,从而导致潜在的错误.但是我仍然希望尽可能多地使用这些旧工具,因为它们既稳定又快速.
  1. lightweight. I know renaming *.txt to *.odt and then use libreoffice is a pathway, but it will load the heavy libreoffice.
  2. 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.

非常感谢!

推荐答案

一种方法是使用 ,后跟 ps2pdf >

enscript -p file.ps file.txt
ps2pdf file.ps file.pdf

这篇关于在Linux中将文本转换为pdf的简便解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆