Created: 4/2001; Updated 12/2001 & 2/2004

Make an RTF Document with PHP

Enter your name:     
Enter your lastname: 
Enter your address:  
Enter your city:     
Enter your state:    
Enter your zip:      

NOTE: I didn't do an magic here, I just modified the ideas at irt.org on producing RTF files with Cold Fusion
- joe

download the kit, in a unix .tar file

This is unsupported software. Joy of learning and all that.

Update 1/2002: Matthew Walden had some issues getting this to work under IIS and Apache. His comments may be helpful. Thanks Matthew!

I had problems getting apache and MS IIS working with RTF documents. I fixed apache by adding the following line into httpd.conf :

AddType application/x-httpd-php .rtf

IIS has a slightly more long winded solution :

In the management console, under the properties for the virtual (or default) web in the home directory, go to home directory | application settings | configuration. Click on "Add" and enter the path to the php.exe as it is set for .php files. (For me this was C:\PHP\php.exe "%s" "%s"). Type .rtf as the extension and press OK.

The web / web service may need to be restarted for the changes to be reflected.
And on changing textarea type documents so that the newlines propagate to the RTF file, I got this feedback:
<?print print str_replace('<br />', '\line',nl2br(StripSlashes($_POST['address'])))?> 
Thanks to Mariusz for this feedback!
blog comments powered by Disqus