TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 07-01-2009, 09:43 AM   #1 (permalink)
The Visitor
 
Join Date: Jul 2009
Posts: 2
Thanks: 0
sumeshtg is on a distinguished road
Default Rtf to Html

How can be convert rtf data to html code in php?
sumeshtg is offline  
Reply With Quote
Old 07-01-2009, 04:12 PM   #2 (permalink)
The Addict
 
Join Date: May 2009
Posts: 287
Thanks: 5
adamdecaf is on a distinguished road
Default

It would help if you gave us a sample of the code so we could guide you. You are looking at some pretty nifty regular expressions for this.
__________________
My Site
adamdecaf is offline  
Reply With Quote
Old 07-02-2009, 07:05 AM   #3 (permalink)
The Visitor
 
Join Date: Jul 2009
Posts: 2
Thanks: 0
sumeshtg is on a distinguished road
Default Our plan

We have an RTF file saved in the database. If we pull the data and write it as a file, without any further
processing/formatting, it should be possible to open the file in an RTF reader application, say, Wordpad.
In other words, we are storing the RTF file as 'raw' data.

Our plan is to bring this onto the www browser, like firefox or IE (to allow editing)and put the contents
in a 'Rich Text Area' that the end user can edit the contents, without loosing the formatting. So far, we
have not seen any online RTF editor, or a plug-in that is closely integrated with a browser, like Acrobat
Reader in the case of PDF files.

One solution is to use a Rich Text (WYSIWYG) editor that can integrate with php. In this case we need
to convert the RTF on the fly to HTML and import the formatted contents to a WYSIWYG Rich Text editor.

Ideally we are looking for a php class do this.

After editing, the formatted (ie, bold, italic, etc. etc) content needs to be ideally converted back to RTF when
the end user "Saves" it, and be stored in the database. We need the saved the document in RTF ideally,
but we can live with HTML too.

The difficulty is that we are getting the data initially from an external source in RTF format and we
are trying to provide an online editing feature. The RTF file can contain header/footer/images in addition
to styled text.

any suggestion?
sumeshtg is offline  
Reply With Quote
Old 07-02-2009, 03:23 PM   #4 (permalink)
The Addict
 
Join Date: May 2009
Posts: 287
Thanks: 5
adamdecaf is on a distinguished road
Default

I don't thing you will just be able to "transfer" the rtf over. Your best bet is to take the files contents (html) and paste it into a <textarea> like element, (<pre> would keep the formatting at a loss of edit ability).

I guess it may be easier to store the files in xml/html and then convert them to .rtf (server side copy/paste when a user requests the file). Also when the user wants to edit it the html could be copy/pasted into a box.
__________________
My Site
adamdecaf is offline  
Reply With Quote
Old 07-04-2009, 08:29 PM   #5 (permalink)
The Contributor
 
Join Date: Jun 2009
Location: Seattle, WA
Posts: 76
Thanks: 1
rguy84 is on a distinguished road
Default

Sum, have you looked at a RTF file in say notepad? The actual coding in the back of a file is like LaTeX or PostScript. Writing rtf files is kind of a nightmare. Here's a RTF file that says hello in bold
Code:
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}}
{\*\generator Msftedit 5.41.15.1515;}\viewkind4\uc1\pard\b\f0\fs20 hello\par
}
I believe {\*\generator Msftedit 5.41.15.1515;} is a comment. But yeah the rest is needed.
__________________
Ryan | Blog | Twitter
Send a message via AIM to rguy84 Send a message via MSN to rguy84 Send a message via Yahoo to rguy84 Send a message via Skype™ to rguy84
rguy84 is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Exciting Stuff in HTML 5! Wildhoney XHTML, HTML, CSS 20 02-17-2013 03:16 PM
HTML & Wordpress Integration Wildhoney General 2 01-10-2009 08:11 PM
problem getting data on the html table.... jetnet1 General 2 11-24-2008 06:55 PM
Execute a script and call that file in an HTML page j4v1 General 2 05-22-2008 01:41 PM
Embeding PHP inside HTML documents Orc General 8 01-18-2008 08:10 PM


All times are GMT. The time now is 03:25 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design