CAM::PDF is very naive (i.e. fitting great to tasks it was designed to solve at the time) about text extraction. Single-byte encoding only, not to mention just Latin1, and the "ToUnicode" tables ignored completely. Don't even try this or any other pure Perl modules for serious extraction. Last time I checked, the muPDF tool (and matching, but not always -- depending on version unfortunately -- Ghostscript's txtwrite device) produce nice xml output with correctly (if it's possible at all for this PDF) encoded characters, along with position, style attributes etc. Then these tools' output can be parsed using XML::Simple or similar, i.e. with Perl.
Edit. I have a patch for CAM::PDF, but maybe first you provide your typical PDF (or two, if from diverse sources) for tests. Text encoding was not a problem, but as I see there are also rather naive choices in regard to layout heuristics. May run into problems, then it's all not worth the effort and better to use dedicated tools.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|