Read rtf ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
satheshf12000
Forum Commoner
Posts: 25
Joined: Mon Sep 04, 2006 5:38 pm

Read rtf ?

Post by satheshf12000 »

Hi all..

I am wondering on how to read an rtf file through php. Its printing as if it was opened as a text file. somethings are included automatically like this..
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}} {\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\f0\fs20 hi this is a long test.\par this is sat testing the file.\par } 0
any help is really appreciated.

thanks..
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

search around for a library. I looked on PEAR and there doesn't seem to be anything there, which I find rather surprising but meh.
mentor
Forum Contributor
Posts: 100
Joined: Sun Mar 11, 2007 11:10 am
Location: Pakistan

Post by mentor »

You can read rtf using COM. Read the user comments at the bottom of the page.

COM functions are only available for the Windows version of PHP.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

If you have lots of time you can also look at the RTF Specification.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

The last I checked, there are really no satisfactory pure-PHP RTF parsers out there right now. COM will let you piggy back off of Microsoft Word's RTF parsing capabilities (which are fairly good), and that PHP class looks interesting but probably has incomplete coverage of the RTF spec.
Post Reply