<p>We get a large amount of data from our clients in pdf files in varying formats [layout-wise], these files are typically report output, and are typically properly annotated [they don't usually need OCR], but not formatted well enough that simply copying several hundred pages of text out of acrobat is not going to work.</p>

<p>The best approach I've found so far is to write a script to parse the nearly-valid xml output (the comments are invalid and many characters are escaped in varying ways, é becomes [[[e9]]]é, $ becomes \$, % becomes \%...) of the command-line pdftoipe utility (to convert pdf files for a program called <a href="http://tclab.kaist.ac.kr/ipe/" rel="nofollow noreferrer">ipe</a>), which gives me text elements with their positions on each page [see sample below], which works well enough for reports where the same values are on the same place on every page I care about, but would require extra scripting effort for importing matrix [cross-tab] pdf files. pdftoipe is not at all intended for this, and at best can be compiled manually using cygwin for windows.</p>

<p>Are there libraries that make this easy from some scripting language I can tolerate?  A graphical tool would be awesome too.  And a pony. </p>

<p>pdftoipe output of <a href="http://brunndahl.navarro.se/sida_002/?CoMeT_function=get_file&amp;id=9_1" rel="nofollow noreferrer" title="sample pdf file">this sample</a> looks like this:</p>

<pre><code>&lt;ipe creator="pdftoipe 2006/10/09"&gt;&lt;info media="0 0 612 792"/&gt;
&lt;-- Page: 1 1 --&gt;
&lt;page gridsize="8"&gt;
&lt;path fill="1 1 1" fillrule="wind"&gt;
64.8 144 m
486 144 l
486 727.2 l
64.8 727.2 l
64.8 144 l
h
&lt;/path&gt;
&lt;path fill="1 1 1" fillrule="wind"&gt;
64.8 144 m
486 144 l
486 727.2 l
64.8 727.2 l
64.8 144 l
h
&lt;/path&gt;
&lt;path fill="1 1 1" fillrule="wind"&gt;
64.8 144 m
486 144 l
486 727.2 l
64.8 727.2 l
64.8 144 l
h
&lt;/path&gt;
&lt;text stroke="1 0 0" pos="0 0" size="18" transformable="yes" matrix="1 0 0 1 181.8 707.88"&gt;This is a sample PDF fil&lt;/text&gt;
&lt;text stroke="1 0 0" pos="0 0" size="18" transformable="yes" matrix="1 0 0 1 356.28 707.88"&gt;e.&lt;/text&gt;
&lt;text stroke="1 0 0" pos="0 0" size="18" transformable="yes" matrix="1 0 0 1 368.76 707.88"&gt; &lt;/text&gt;
&lt;text stroke="0 0 0" pos="0 0" size="12.6" transformable="yes" matrix="1 0 0 1 67.32 692.4"&gt; &lt;/text&gt;
&lt;text stroke="0 0 0" pos="0 0" size="12.6" transformable="yes" matrix="1 0 0 1 67.32 677.88"&gt; &lt;/text&gt;
&lt;text stroke="0 0 0" pos="0 0" size="12.6" transformable="yes" matrix="1 0 0 1 67.32 663.36"&gt; &lt;/text&gt;
&lt;text stroke="0 0 0" pos="0 0" size="12.6" transformable="yes" matrix="1 0 0 1 67.32 648.84"&gt; &lt;/text&gt;
&lt;text stroke="0 0 0" pos="0 0" size="12.6" transformable="yes" matrix="1 0 0 1 67.32 634.32"&gt; &lt;/text&gt;
&lt;text stroke="0 0 0" pos="0 0" size="12.6" transformable="yes" matrix="1 0 0 1 67.32 619.8"&gt; &lt;/text&gt;
&lt;text stroke="0 0 0" pos="0 0" size="12.6" transformable="yes" matrix="1 0 0 1 67.32 605.28"&gt; &lt;/text&gt;
&lt;text stroke="0 0 0" pos="0 0" size="12.6" transformable="yes" matrix="1 0 0 1 67.32 590.76"&gt; &lt;/text&gt;
&lt;text stroke="0 0 0" pos="0 0" size="12.6" transformable="yes" matrix="1 0 0 1 67.32 576.24"&gt; &lt;/text&gt;
&lt;text stroke="0 0 0" pos="0 0" size="12.6" transformable="yes" matrix="1 0 0 1 67.32 561.72"&gt; &lt;/text&gt;
&lt;text stroke="0 0 0" pos="0 0" size="12.6" transformable="yes" matrix="1 0 0 1 67.32 547.2"&gt; &lt;/text&gt;
&lt;text stroke="0 0 0" pos="0 0" size="12.6" transformable="yes" matrix="1 0 0 1 67.32 532.68"&gt; &lt;/text&gt;
&lt;text stroke="0 0 0" pos="0 0" size="12.6" transformable="yes" matrix="1 0 0 1 67.32 518.16"&gt; &lt;/text&gt;
&lt;text stroke="0 0 0" pos="0 0" size="12.6" transformable="yes" matrix="1 0 0 1 67.32 503.64"&gt; &lt;/text&gt;
&lt;text stroke="0 0 0" pos="0 0" size="12.6" transformable="yes" matrix="1 0 0 1 67.32 489.12"&gt; &lt;/text&gt;
&lt;text stroke="0 0 0" pos="0 0" size="12.6" transformable="yes" matrix="1 0 0 1 67.32 474.6"&gt; &lt;/text&gt;
&lt;text stroke="0 0 1" pos="0 0" size="16.2" transformable="yes" matrix="1 0 0 1 67.32 456.24"&gt;If you can read this&lt;/text&gt;
&lt;text stroke="0 0 1" pos="0 0" size="16.2" transformable="yes" matrix="1 0 0 1 214.92 456.24"&gt;,&lt;/text&gt;
&lt;text stroke="0 0 1" pos="0 0" size="16.2" transformable="yes" matrix="1 0 0 1 219.48 456.24"&gt; you already have A&lt;/text&gt;
&lt;text stroke="0 0 1" pos="0 0" size="16.2" transformable="yes" matrix="1 0 0 1 370.8 456.24"&gt;dobe Acrobat &lt;/text&gt;
&lt;text stroke="0 0 1" pos="0 0" size="16.2" transformable="yes" matrix="1 0 0 1 67.32 437.64"&gt;Reader i&lt;/text&gt;
&lt;text stroke="0 0 1" pos="0 0" size="16.2" transformable="yes" matrix="1 0 0 1 131.28 437.64"&gt;n&lt;/text&gt;
&lt;text stroke="0 0 1" pos="0 0" size="16.2" transformable="yes" matrix="1 0 0 1 141.12 437.64"&gt;stalled on your computer.&lt;/text&gt;
&lt;text stroke="0 0 0" pos="0 0" size="16.2" transformable="yes" matrix="1 0 0 1 337.92 437.64"&gt; &lt;/text&gt;
&lt;text stroke="0 0.502 0" pos="0 0" size="12.6" transformable="yes" matrix="1 0 0 1 342.48 437.64"&gt; &lt;/text&gt;
&lt;image width="800" height="600" rect="-92.04 800.64 374.4 449.76" ColorSpace="DeviceRGB" BitsPerComponent="8" Filter="DCTDecode" length="369925"&gt;
feedcafebabe...
&lt;/image&gt;
&lt;/page&gt;
&lt;/ipe&gt;
</code></pre>

[{'answer_id': 25565, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>Have you looked at Aspose? We\'re using it for an ASP.net app and I\'ve seen some examples of vbscript using it as well. It\'s not particularly expensive either.</p>\n\n<p><a href="http://www.aspose.com/" rel="nofollow noreferrer">http://www.aspose.com/</a></p>\n'}, {'answer_id': 25631, 'author': 'roo', 'author_id': 716, 'author_profile': 'https://Stackoverflow.com/users/716', 'pm_score': 3, 'selected': True, 'text': '<p>We use <a href="http://www.foolabs.com/xpdf/about.html" rel="nofollow noreferrer">Xpdf</a> in one of our applications. Its a c++ library which is primarily used for pdf rendering, although it does have a text extractor which could be useful for this project.</p>\n'}, {'answer_id': 48181, 'author': 'Tony Meyer', 'author_id': 4966, 'author_profile': 'https://Stackoverflow.com/users/4966', 'pm_score': 1, 'selected': False, 'text': '<p>If you\'re fine with calling something external, you can use <a href="http://pages.cs.wisc.edu/~ghost/" rel="nofollow noreferrer">ghostscript</a> - look at the ps2ascii script included with the distribution.  I\'m not sure what you want from a graphical tool - a big button that you push to chose the input and output files?  A preview?  You might be able to use GSView, depending on what you want.</p>\n'}, {'answer_id': 4169723, 'author': 'Decora', 'author_id': 506335, 'author_profile': 'https://Stackoverflow.com/users/506335', 'pm_score': 1, 'selected': False, 'text': '<p>pdftohtml -xml </p>\n\n<p>although pdftoipe seems more detailed!! </p>\n'}]
['https://Stackoverflow.com/questions/25550', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2775/']