RTF::Text::Converter

S

stov753

I need to parse converted RTF files on Red Hat, and CPAN'ed
RTF::Text::Converter for that purpose. But the text converter yields
only the first few lines of the file. I've tried a number of variations
on:

require RTF::TEXT::Converter;
my $result;
my $self = new RTF::TEXT::Converter(output => \$result);

if (@ARGV) {
foreach my $filename (@ARGV) {
$self->parse_stream($filename);
print $result;
$result = '';

The RTF::HTML::Converter works perfectly on these files, as does the
RTF::Tokenizer. Can anyone explain this?

Steven Stovall
(e-mail address removed)
 
B

Brian Wakem

I need to parse converted RTF files on Red Hat, and CPAN'ed
RTF::Text::Converter for that purpose. But the text converter yields
only the first few lines of the file. I've tried a number of variations
on:

require RTF::TEXT::Converter;
my $result;
my $self = new RTF::TEXT::Converter(output => \$result);

if (@ARGV) {
foreach my $filename (@ARGV) {
$self->parse_stream($filename);
print $result;
$result = '';

The RTF::HTML::Converter works perfectly on these files, as does the
RTF::Tokenizer. Can anyone explain this?


I've successfully parsed several thousand RTFs with the following code
snippet. I can't see any real difference in the code. Do you get any
errors?


use RTF::TEXT::Converter;
my $doc;
my $self = new RTF::TEXT::Converter(Output => \$doc);
$self->parse_stream($filename);


Actually come to think of it I had to upgrade to a newer version of
RTF::TEXT::Converter at one point when it started failing on certain
documents (change in specification perhaps?). Maybe you should make sure
you have the latest version.
 
S

stov753

Actually, it does seem to be in the RTF. I have about half a dozen
files. A couple of them actually parsed. A couple of them squeezed out
the first line or so of the document and nothing more. But on the last
one I got a suggestion to use "sloppy" because the converter had
encountered an "illegal" expression...so I'm trying to figure out how
to use "sloppy". But I'm definitely using the latest version.

Steven Stovall
(e-mail address removed)
 
S

stov753

Please disregard my last posting, which was based on an errant run. I
have half a dozen very similar files, and they all yield nothing more
than the first 10 or so text tokens. But I can dump the text token by
token, using the tokenizer -- which I guess is really the best I can
do.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top