Does anyone know of a PDF file parser that I could use to pull out sections of text from the plaintext pdf file? Specifially I want a way to be able to reliably pull out the section of text specific to annotations?
Delphi, C# RegEx I dont mind.
Does anyone know of a PDF file parser that I could use to pull out sections of text from the plaintext pdf file? Specifially I want a way to be able to reliably pull out the section of text specific to annotations?
Delphi, C# RegEx I dont mind.
The PDF File Parser article on xactpro seems to be exactly what you need. It explains the format of the PDF and comes with full source code for a parser (and another project for visualisation of the model).
The parser uses format-specific terms, but you could easily use the visualiser to learn what to look for.
You can also take a look at Xpdf (http://www.foolabs.com/xpdf/download.html)
Not sure if it supports the functionality you need, but we've been using abcPDF with some success.
abcPDF does let you extract annotations, they have a very good section in the help for it, but the code to handle it is generally :
for (int objectIndex = 0; objectIndex < theDoc.ObjectSoup.Count; objectIndex++)
{
try
{
IndirectObject element = theDoc.ObjectSoup.ElementAt(objectIndex);
string elementType = element.GetType().ToString();
switch (elementType)
{
case "WebSupergoo.ABCpdf8.Objects.Annotation":
//process the annotation, which could be all kinds of stuff
WebSupergoo.ABCpdf8.Objects.Annotation annotation = (WebSupergoo.ABCpdf8.Objects.Annotation)element;
ProcessAnnotation(annotation);
...
I don't know all the features of these PDF parsers, but Aspose has a pretty comprehensive one. We did, unfortunately, come across two bugs, and I've been waiting a long time for them to be fixed.
ITextSharp seems to be the most common open source PDF parser for .Net.