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

2

3

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?

Bonded answered 28/10, 2010 at 21:44 Comment(2)
possible duplicate of Need RTF/doc to html converter, preferably freeLarena
I'll leave this here in case anyone comes across it. github.com/henck/rtf-html-php if this helps anyone further.Farad
S
6

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).

Skylar answered 28/10, 2010 at 21:47 Comment(3)
That code is terrible to read, but it works. Thanks!Bonded
How is this used? I need to get text out of RTF data and I can't seem to figure this one out.Sheba
the whole answer does not help. how do i get this suggested code to work? And no i dont have time to look up all 3423423 files of code.Kutuzov
I
0

According to the answer of https://mcmap.net/q/1164744/-free-preferably-php-rtf-to-html-converter-closed

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);
Infertile answered 30/4, 2013 at 8:14 Comment(1)
this answer does not work. Your suggested code snippet 'exec(rtf2htm file.rtf file.html); ' is terribly written and is not the way of solution.Kutuzov

© 2022 - 2024 — McMap. All rights reserved.