Free (preferably) PHP RTF to HTML converter? [closed]

旧时模样 提交于 2019-11-27 03:39:03

问题


I am writing a converter for an old db app which contains a large amount of user entered RTF text. Ideally, the RAW RTF should be converted to HTML for display in a browser.

I have tried rtfparseclass from PHP Classes, which works ok, but seems to be thrown off but some of the embedded font definitions. For example, raw RTF like {\f1\fnil Tahoma;} always truncates the output produced by the parser, causing detail to be lost. I don't know RTF well enough to know if that should be valid or not. The class was last updated in 2004 so I'm guessing that it may just be out of date.

Other than updating rtfparseclass to ignore the fonts, does anyone know of a PHP library to convert RTF to HTML?


回答1:


Have a look here: http://freshmeat.net/projects/rtf2htm/

The RTF to HTML convertor converts RTF files (in Windows-1250 encoding) to HTML file (in ISO-8859-2 encoding).




回答2:


According to the answer of https://stackoverflow.com/a/4047420/1875208

Little bit late but this one works only with commandline-execution, such as exec();

You need at least provide 3 parameters:

  1. Path to rtf2htm on your server
  2. Path of the rtf-document (yes, you´ll need to save it to a file before)
  3. Filepath to where the converted html should be outputted.

It could then look like this:

exec(rtf2htm file.rtf file.html);


来源:https://stackoverflow.com/questions/4047411/free-preferably-php-rtf-to-html-converter

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