gt10001
gt10001

Reputation: 182

Create RTF files from PHP (any better way?)

Currently I am generating RTF documents using PHPRtfLite. It works perfectly. The only issue is that I have more than 1000 documents with one or more pages in each. To output them via PHPRtfLite, I have to copy paste the data + write formatting details (such as bold, italics or table) into my php file using PHPRtfLite methods. That means a lot of copy and paste. The resulting PHP file is big and messy.

Is there any better / easier way?

Currently I create one PHP file per RTF file.

Thank you for any suggestions.

Best regards,

Tony.

Upvotes: 0

Views: 2842

Answers (1)

pho
pho

Reputation: 25489

Look at the PHPRtfLite code, you'll see how to format text to rtf.

Then, put in a loop in your php, and open each file, read the file and output it.
Then close both files and move on to next file

EDIT

@TonyGeorge in that case, load the rtf file

$h=fopen("myfile.rtf", "r");
$text=fread($h);
fclose($h);
//Now put the code that handles the rtf conversion, the contents of the rtf will be in $text

Upvotes: 1

Related Questions