Read files in RTF format and generate a TXT file

Asked

Viewed 332 times

3

It has how to read an RTF type file and rewrite it in TXT format, using PHP?
I ran some tests using fopen() and file_get_contents(), but the results were not as expected.

  • 2

    See if it helps http://webcheatsheet.com/PHP/reading_the_clean_text_from_rtf.php

1 answer

2


It would be easier if you used libraries for this purpose.

https://github.com/jstewmc/rtf

According to the example that’s there on Github, you can do:

$doc = new \Jstewmc\Rtf\Document();
$doc->load('/path/to/file.rtf');
$doc->write('text'); 

Browser other questions tagged

You are not signed in. Login or sign up in order to post.