Linux: Command Line Utility Convert RTF to PDF?

吃可爱长大的小学妹 提交于 2020-01-22 14:13:46

问题


Any recommendations to convert an RTF to a PDF? I need to do this from my LAMP application, so a command line utility like GhostScript would be ideal.


回答1:


sudo apt-get install ted

/usr/share/ted/Ted/rtf2pdf.sh source-file dest-file

or visit this link




回答2:


Alternatively, you can use libreoffice for this task:

libreoffice --headless --invisible --norestore --convert-to pdf source-file.rtf



回答3:


In my Ubuntu 10.4 I have unrtf, which "converts RTF to HTML, LaTeX, Postscript". From Postscript it should be a trivial application of ps2pdf to get PDFs.




回答4:


Under Cent OS 6, these steps worked for me to convert RTF to PDF from a php file:

  1. yum install Ted
  2. yum install ghostscript
  3. Download rtf2pdf.sh to some path like: /var/www/html/lib, where Apache has sufficient permissions
  4. shell_exec('sh /lib/rtf2pdf.sh /files/test.rtf /files/test.pdf');



回答5:


unoconv does this very conveniently. (FYI, I'm currently using version 0.5-1 of same). I have to first run a unoconv --listener & command, followed by a unoconv *.rtf command, for example...



来源:https://stackoverflow.com/questions/6866376/linux-command-line-utility-convert-rtf-to-pdf

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