I ran in the same error and here is the "empirical" way I found to solve it.
I'm working on a Windows XP machine with Activeperl 5.10.0 Build 1003. My CAM-PDF module version is 1.13,
the versions of its dependecies are Text-PDF module version 0.29 and Crypt-RC4 module version 2.02
As CaMelRyder reported, from this simple program:
use strict; use warnings; use CAM::PDF;
my $pdf = CAM::PDF->new("test.pdf"); # test.pdf is the existing pdf
my $string = $pdf->getPageText(1);
open (C, ">", "test.txt"); print C $string; # print extracted string
.. I obtained this error:
Failed to open filter FlateDecode (Text::PDF::FlateDecode)
Unrecognized type in parseAny:
1 £ý¢═«ý╩▓ØÎ▀O▒:♠÷n£Õ╩...
the really strange thing was that adding ONE LINE at the beggining of the program:
@INC=('C:/Perl/lib','C:/Perl/site/lib','.'); # THIS LINE IS ADDED
use strict; use warnings; use CAM::PDF;
my $pdf = CAM::PDF->new("test.pdf"); # test.pdf is the existing pdf
my $string = $pdf->getPageText(1);
open (C, ">", "test.txt"); print C $string; # print extracted string
everything worked fine and no error message was displayed.
What I've done is a very little change to the Perl special variable @INC which is: (from perldoc)
"The array @INC contains the list of places that the use construct look for its library files."
Usually the content of this array @INC is ('C:/Perl/site/lib','C:/Perl/lib','.')
I verified that by typing from the command line of my computer: perl -de0
in this way I opened the perl debugger and I typed: x @INC
On resume, I obtained that:
usually _______________ => @INC is ____ ('C:/Perl/site/lib','C:/Perl/lib','.')
to make CAM-PDF working => @INC must be ('C:/Perl/lib','C:/Perl/site/lib','.') => I INVERTED THE FIRST TWO ELEMENTS OF @INC
I DON'T KNOW THE REASON OF ALL THAT, AND I WAIT FOR EXPLANATIONS FROM SOME PERLMONK MORE EXPERT THAN ME.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.