PHP Classes

Valid working class?

Recommend this page to a friend!

      RTF Parse class  >  All threads  >  Valid working class?  >  (Un) Subscribe thread alerts  
Subject:Valid working class?
Summary:I Receive only errors for this class
Messages:12
Author:David Bustin
Date:2006-01-15 09:28:14
Update:2010-03-29 14:21:24
 
  1 - 10   11 - 12  

  1. Valid working class?   Reply   Report abuse  
Picture of David Bustin David Bustin - 2006-01-15 09:28:14
Is this a usable class?

This class seems to be a great idea but I am not able to make it function correctly. I have followed the "How to use this class" example from within the class itself only to receive the following two errors repeatedly:

Notice: Undefined index: fonttbl_want_fcharset in C:\phptestdir\include\rtfclass.php on line 388

Notice: Undefined index: fonttbl_current_read in C:\phptestdir\include\rtfclass.php on line 405

The usage is:
$fileContent = file_get_contents($convertFile);
$r = new rtf( stripslashes( $fileContent ));
$r->output( "html");
$r->parse();
if( count( $r->err) == 0) // no errors detected
echo $r->out;

I can correctly display the raw file content but it is still not working.

Thank you in advance,
Dave

  2. Re: Valid working class?   Reply   Report abuse  
Picture of antech antech - 2006-01-31 09:32:58 - In reply to message 1 from David Bustin
Exactly the same problem.
Any help would be appreciated

  3. Re: Valid working class?   Reply   Report abuse  
Picture of Dying ANgel Dying ANgel - 2006-02-06 04:43:39 - In reply to message 2 from antech
same problem here ...
and my document is blank rtf document created by wordpad

  4. Re: Valid working class?   Reply   Report abuse  
Picture of Lloyd Borrett Lloyd Borrett - 2006-09-03 00:05:24 - In reply to message 3 from Dying ANgel
Has anyone managed to get this class to work, and if so how?

I get nothing back from it.

  5. Re: Valid working class?   Reply   Report abuse  
Picture of Dan Darie Dan Darie - 2006-10-02 22:50:56 - In reply to message 4 from Lloyd Borrett
Get rid of the stripslashes crap.

  6. Re: Valid working class?   Reply   Report abuse  
Picture of Lloyd Borrett Lloyd Borrett - 2006-10-02 23:27:48 - In reply to message 5 from Dan Darie
Doesn't work for me with the stripslashes, as documented, or without it.

Does anyone have this class working? If so, with what version of PHP?

  7. Re: Valid working class?   Reply   Report abuse  
Picture of Aaron V Aaron V - 2007-01-07 01:43:10 - In reply to message 6 from Lloyd Borrett
I don't think the filename is supposed to get passed through.

I think the actual contents need to be.


$rtf = 'test.rtf';
$r = new rtf(file_get_contents(stripslashes($rtf)));
$r->output( "html");
$r->parse();
if( count( $r->err) == 0) // no errors detected
echo $r->out;

Works for me.

The only problem is it still has those notices.

Notice: Undefined index: fonttbl_want_fcharset in c:\program files\apache group\Apache\document_root\FM\rtfclass.php on line 388

Notice: Undefined index: fonttbl_current_read in c:\program files\apache group\Apache\document_root\FM\rtfclass.php on line 405

Notice: Undefined index: fonttbl_want_fcharset in c:\program files\apache group\Apache\document_root\FM\rtfclass.php on line 388

etc etc...

I need some way to turn them off, or resolve the issue of them appearing. I'll post back if I figure out how.

  8. Re: Valid working class?   Reply   Report abuse  
Picture of Alexis Morin Alexis Morin - 2007-03-19 19:52:08 - In reply to message 7 from Aaron V
I have the same problem at the moment, I'm trying to fix it.
I found that if your rtf file is shorter, you get less errors, so obviously something is being checked in the file more than once.

post back any replies if you guys find a solution.

  9. Re: Valid working class?   Reply   Report abuse  
Picture of Tom Wouters Tom Wouters - 2007-09-07 08:24:21 - In reply to message 7 from Aaron V
just put an @ in front of $r->parse() to suppress the notices php generates.
(or turn off outputting of errors in the php.ini and use logging)


  10. Re: Valid working class?   Reply   Report abuse  
Picture of Mannu Bhai Gupta Mannu Bhai Gupta - 2010-03-12 13:12:37 - In reply to message 9 from Tom Wouters
It works for me but not perfectly. Usage code will be

<?php

require('rtfclass.php');

$myFile = "d:\\rtf2htmlusingphp.rtf";
$fh = fopen($myFile, 'r');
$rtf = fread($fh, filesize($myFile));
fclose($fh);


$r = new rtf( $rtf); // do not use stripslashes here
$r->output( "html");
@$r->parse();
if( count( $r->err) == 0) // no errors detected
echo $r->out;
else
echo "Error Occured";
?>

 
  1 - 10   11 - 12