Read .RTF file using PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tokcy
    New Member
    • Sep 2008
    • 45

    Read .RTF file using PHP

    Hi everyone,

    I have some .rtf extension file and i want to read that file using php on html page but i am not able to do this.

    If it is .txt file then there is no problem but it is RTF and DOC file. Can any one tell me the soluion.

    i will be very thank full to all its very urgent.
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    what do you see when you try to read the file?

    Are you looking to display in the same format and font as the Rich Text or just looking for the textual data?

    Comment

    • tokcy
      New Member
      • Sep 2008
      • 45

      #3
      when i am trying to open the rtf file it looks something like this

      {\rtf1\ansi\ans icpg1252\deff0\ deflang1033{\fo nttbl{\f0\fswis s\fcharset0 Arial;}{\f1\fsw iss\fprq2\fchar set0 Arial;}"

      and i want to display the text of file as it is...

      Comment

      • dlite922
        Recognized Expert Top Contributor
        • Dec 2007
        • 1586

        #4
        Well first, I hope that's not the complete file, but thanks for showing me a sample. For you to get the text is to strip out all the RTF formatting (which look like what you posted) Try to look for pattern of where your data is (and isn't) and build a regex to capture your data.

        RegexBuddy is a highly recommended program for regex beginners.



        Dan

        Comment

        • tokcy
          New Member
          • Sep 2008
          • 45

          #5
          Hi thanks for your reply but regex is working file with .DOC file and not working with .RTF file.
          I am sending all rtf format for file and original format also...

          Original format is

          Acknowledgment by Endorsement on Deed

          Paid a sum of Rs . . . . . . . . towards part-payment of the amount due on this pronote.
          Dated. . . . . . . .     A.B.
                  (Signature)

          and Rtf format is


          rtf1 ansi ansicpg1252 uc1 deff2 stshfdbch0 stshfloch0 stshfhich0 stshfbi0 deflang2057 deflangfe2057 fonttbl f0 froman fcharset0 fprq2 panose 020206030504050 20304 Times New Roman f2 fmodern fcharset0 fprq1 panose 020703090202050 20404 Courier New f11 froman fcharset128 fprq1 panose 020206090402050 80304 MS Mincho falt l r 81 66c f37 froman fcharset0 fprq2 panose 000000000000000 00000 Times f38 fmodern fcharset128 fprq1 panose 020206090402050 80304 @MS Mincho f199 froman fcharset238 fprq2 Times New Roman CE f200 froman fcharset204 fprq2 Times New Roman Cyr f202 froman fcharset161 fprq2 Times New Roman Greek f203 froman fcharset162 fprq2 Times New Roman Tur f204 froman fcharset177 fprq2 Times New Roman (Hebrew) f205 froman fcharset178 fprq2 Times New Roman (Arabic) f206 froman fcharset186 fprq2 Times New Roman Baltic f207 froman fcharset163 fprq2 Times New Roman (Vietnamese) f219 fmodern fcharset238 fprq1 Courier New CE f220 fmodern fcharset204 fprq1 Courier New Cyr f222 fmodern fcharset161 fprq1 Courier New Greek f223 fmodern fcharset162 fprq1 Courier New Tur f224 fmodern fcharset177 fprq1 Courier New (Hebrew) f225 fmodern fcharset178 fprq1 Courier New (Arabic) f226 fmodern fcharset186 fprq1 Courier New Baltic f227 fmodern fcharset163 fprq1 Courier New (Vietnamese) f569 froman fcharset238 fprq2 Times CE f570 froman fcharset204 fprq2 Times Cyr f572 froman fcharset161 fprq2 Times Greek f573 froman fcharset162 fprq2 Times Tur f574 froman fcharset177 fprq2 Times (Hebrew) f575 froman fcharset178 fprq2 Times (Arabic) f576 froman fcharset186 fprq2 Times Baltic f577 froman fcharset163 fprq2 Times (Vietnamese) colortbl red0 green0 blue0 red0 green0 blue255 red0 green255 blue255 red0 green255 blue0 red255 green0 blue255 red255 green0 blue0 red255 green255 blue0 red255 green255 blue255 red0 green0 blue128 red0 green128 blue128 red0 green128 blue0 red128 green0 blue128 red128 green0 blue0 red128 green128 blue0 red128 green128 blue128 red192 green192 blue192 stylesheet ql fi-360 li360 ri1440 sb26 sl-226 slmult0 widctlpar tqr tldot tx15120 aspalpha aspnum faauto adjustright rin1440 lin360 itap0 f2 fs20 lang1033 langfe1033 cgrid langnp1033 langfenp1033 snext0 Normal cs10 additive ssemihidden Default Paragraph Font ts11 tsrowd trftsWidthB3 trpaddl108 trpaddr108 trpaddfl3 trpaddft3 trpaddfb3 trpaddfr3 trcbpat1 trcfpat1 tscellwidthfts0 tsvertalt tsbrdrt tsbrdrl tsbrdrb tsbrdrr tsbrdrdgl tsbrdrdgr tsbrdrh tsbrdrv ql li0 ri0 widctlpar aspalpha aspnum faauto adjustright rin0 lin0 itap0 fs20 lang1024 langfe1024 cgrid langnp1024 langfenp1024 snext11 ssemihidden Normal Table s15 ql fi-360 li360 ri1440 sb26 sl-226 slmult0 widctlpar tqc tx4320 tqr tx8640 aspalpha aspnum faauto adjustright rin1440 lin360 itap0 f2 fs20 lang1033 langfe1033 cgrid langnp1033 langfenp1033 sbasedon0 snext15 header s16 qj fi360 li0 ri0 sb160 sl-250 slmult0 widctlpar aspalpha aspnum faauto adjustright rin0 lin0 itap0 f37 fs21 lang2057 langfe1033 cgrid langnp2057 langfenp1033 sbasedon0 snext16 Body Text s17 qc li0 ri0 sb40 sl-238 slmult0 widctlpar aspalpha aspnum faauto adjustright rin0 lin0 itap0 i f37 fs21 lang1033 langfe1033 cgrid langnp1033 langfenp1033 sbasedon0 snext17 styrsid5969195 Form-head s18 qc li0 ri0 sb480 sa40 sl-240 slmult0 widctlpar aspalpha aspnum faauto adjustright rin0 lin0 itap0 b f37 fs21 lang1033 langfe1033 cgrid langnp1033 langfenp1033 sbasedon0 snext18 styrsid5969195 Form-No s19 qj li0 ri0 sb40 sl-236 slmult0 widctlpar tqc tx4320 tqr tx8640 aspalpha aspnum faauto adjustright rin0 lin0 itap0 f37 fs21 lang2057 langfe1033 cgrid langnp2057 langfenp1033 sbasedon0 snext19 footer cs20 additive f37 fs21 sbasedon10 page number latentstyles lsdstimax156 lsdlockeddef0 rsidtbl rsid5775480 rsid5969195 rsid16732211 generator Micr osoft Word 11.0.6568 info title PRECEDENTS author Mrs. Neelu operator JB creatim yr1998 mo1 dy10 hr12 min17 revtim yr2009 mo6 dy8 hr13 min29 version5 edmins1 nofpages1 nofwords28 nofchars160 company EBC Publishing Pvt. Ltd. nofcharsws187 vern24579 paperw11909 paperh16834 widowctrl ftnbj aenddoc pgnstart13 noxlattoyen expshrtn noultrlspc dntblnsbdb nospaceforul hyphcaps0 formshade horzdoc dgmargin dghspace180 dgvspace180 dghorigin1800 dgvorigin1440 dghshow1 dgvshow1 jexpand viewkind1 viewscale100 pgbrdrhead pgbrdrfoot splytwnine ftnlytwnine htmautsp nolnhtadjtbl useltbaln alntblind lytcalctblwd lyttblrtgr lnbrkrule rsidroot5969195 fet0 sectd binsxn7 psz9 sbknone pgnrestart pgnstarts13 linex0 headery1440 footery1440 endnhere sectdefaultcl sftnbj pnseclvl1 pnucrm pnstart1 pnindent720 pnhang pntxta . pnseclvl2 pnucltr pnstart1 pnindent720 pnhang pntxta . pnseclvl3 pndec pnstart1 pnindent720 pnhang pntxta . pnseclvl4 pnlcltr pnstart1 pnindent720 pnhang pntxta ) pnseclvl5 pndec pnstart1 pnindent720 pnhang pntxtb ( pntxta ) pnseclvl6 pnlcltr pnstart1 pnindent720 pnhang pntxtb ( pntxta ) pnseclvl7 pnlcrm pnstart1 pnindent720 pnhang pntxtb ( pntxta ) pnseclvl8 pnlcltr pnstart1 pnindent720 pnhang pntxtb ( pntxta ) pnseclvl9 pnlcrm pnstart1 pnindent720 pnhang pntxtb ( pntxta ) pard plain s16 qj fi720 li2880 ri0 sb80 sl-270 slmult0 widctlpar aspalpha aspnum faauto adjustright rin0 lin2880 itap0 f37 fs21 lang2057 langfe1033 cgrid langnp2057 langfenp1033 fs24 insrsid5969195 par pard plain s17 qc li0 ri0 sb80 sl-270 slmult0 widctlpar aspalpha aspnum faauto adjustright rin0 lin0 itap0 i f37 fs21 lang1033 langfe1033 cgrid langnp1033 langfenp1033 fs24 insrsid5969195 Acknowledgment by Endorsement on Deed par fs24 insrsid16732211 par pard plain s16 qj fi360 li0 ri0 sb80 sl-270 slmult0 widctlpar aspalpha aspnum faauto adjustright rin0 lin0 itap0 f37 fs21 lang2057 langfe1033 cgrid langnp2057 langfenp1033 fs24 lang1033 langfe1033 langnp1033 insrsid5969195 Paid a sum of Rs . . . . . . . . towards part-payment of the amount due on this pronote. par Dated. . . . . . . . tab tab tab tab fs24 lang1033 langfe1033 loch af11 hich af11 dbch af11 langnp1033 insrsid5969195 loch af11 hich af11 dbch f11 u8195 3f loch af11 hich af11 dbch f11 u8195 3f loch af11 hich af11 dbch f11 u8195 3f fs24 lang1033 langfe1033 langnp1033 insrsid5969195 tab tab A.B. par pard s16 qj fi720 li2880 ri0 sb80 sl-270 slmult0 widctlpar aspalpha aspnum faauto adjustright rin0 lin2880 itap0 fs24 loch af11 hich af11 dbch af11 insrsid5969195 loch af11 hich af11 dbch f11 u8195 3f loch af11 hich af11 dbch f11 u8195 3f loch af11 hich af11 dbch f11 u8195 3f loch af11 hich af11 dbch f11 u8195 3f loch af11 hich af11 dbch f11 u8195 3f loch af11 hich af11 dbch f11 u8195 3f loch af11 hich af11 dbch f11 u8195 3f fs24 insrsid5969195 tab tab (Signature) par


          Please if u have some solution then provide me ASAP because its very urgent otherwise i will loose my job...

          Thanks in advance...

          Comment

          Working...