【问题标题】:how to convert rtf to image format ( jpg/png..)如何将 rtf 转换为图像格式 (jpg/png..)
【发布时间】:2012-02-12 21:44:54
【问题描述】:

我需要将包含图像 (jpgs/pngs) 的 rtf 文档转换为图像格式 以编程方式生成 jpgs 或 pngs,您对如何操作有任何想法吗? 在服务器端(网络) 谢谢

【问题讨论】:

    标签: image rtf


    【解决方案1】:

    您可以使用虚拟打印设备,例如:http://www.joyprinter.com/

    【讨论】:

      【解决方案2】:

      如果以编程方式指的是脚本,您可以编写 RTF 程序以打开文件,然后导出为 PDF,然后将 PDF 导出为图像。至少,这种操作在 OS X 上相对容易。你可以完全在 Automator 中完成,使用 TextEdit 和 Preview。否则,在 OS X 上,您还可以尝试访问会做同样事情的核心服务。虽然在 Windows 上没有任何线索。希望对您有所帮助!

      【讨论】:

        【解决方案3】:

        您可能想要编写一个由 cronjob 执行的 bash 脚本。因此,在定义的时间或定义的时间段后,您会将 rtf 文件转换为 jpg。

        虽然我不知道这是否可以满足您的“程序化”需求.. 以下是如何进行此转换:

        要转换包含“高级”功能(如图像)的 rtf 文件,如您的情况,您需要 unoconv,这需要安装 libreoffice。

        unoconv -f pdf "${input_file}"
        

        否则,仅供参考,因为它不是你的情况,如果 rtf 文件只包含简单的文本,你可以避免通过使用级联转换来安装 libreoffice 的要求,例如

        // convert rtf to txt
        unrtf --text "input_file.rtf" > "temp.txt"
        
        // convert txt to pdf
        enscript "temp.txt" -o - | ps2pdf - "temp.pdf"
        
        // convert pdf to jpg
        convert -quality 100 -append "temp.pdf" "output.jpg"
        
        // remove temp files
        trash "temp.txt" "temp.pdf" // or rm if you prefer
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2023-03-05
          • 1970-01-01
          • 2011-05-16
          • 2012-06-01
          • 1970-01-01
          • 2013-01-08
          • 1970-01-01
          • 2018-08-26
          相关资源
          最近更新 更多