1

I'm looking to parse some PDF(extract paragraph from them). I used iTextSharp in the past, but it doesn't support .netCore.

I also tried this lib: https://github.com/VahidN/iTextSharp.LGPLv2.Core but the text extraction doesn't work very nicely, I just get random words, not in the correct, with a lot of incorrect symbols, really not usable.

  • PDF parsing is incredibly difficult, because of (some of the many) ways a PDF can encode text. Like not actually encoding the space character, and just having each word (or character) be positioned. I would suggest that PDF parsing is AI-complete (en.wikipedia.org/wiki/AI-complete) – Lyndon White Oct 17 '17 at 8:31
0

Essential PDF can be used to load PDFs and extract content from them..NET Core is also supported.

//Load an existing PDF.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
//Load the first page.
PdfPageBase page = loadedDocument.Pages[0];
//Extract text from first page.
string extractedText = page.ExtractText();
//Close the document
loadedDocument.Close(true);

The entire product is available for free with no limitations through the community license if you qualify.

Note: I work for Syncfusion

  • I dont earn more than a million, so I should be able to benefit from it. I will test this this evening, thank you – J4N Apr 20 '17 at 3:39
  • Can I get it from a Nuget package? If not, what DLL should I include to get this PdfLoadedDocumentDLL? – J4N Apr 20 '17 at 4:16
  • @J4N: Yes. Nuget feed for .NET Core. The DLLs needed are Syncfusion.Compression.Portable.dll and Syncfusion.Pdf.Portable.dll – Davis Jebaraj Apr 20 '17 at 12:59
  • It seems that I don't have an ExtractTextmethod on the PdfPageBase? What am I missing? – J4N Apr 20 '17 at 14:51
  • 1
    @J4N: Can you please create a support ticket in the Syncfusion support portal and provide a sample PDF document and the text that you are trying to extract. I am working with the developers to get the functionality ported as soon as possible and have additional details will help. Thanks. – Davis Jebaraj Apr 26 '17 at 19:03
0

XFINIUM.PDF library supports text extraction on .NET Core platform.

// Load the PDF document
PdfFixedDocument document = new PdfFixedDocument(input);
// Create a content extractor for the desired page
PdfContentExtractor ce = new PdfContentExtractor(document.Pages[0]);
// Extract text as objects with information about position, font, color, etc
PdfTextFragmentCollection tfc = ce.ExtractTextFragments();
// Or extract the text as a simple string.
string text = ce.ExtractText();

Evaluation version is available for download on nuget.org, package id is xfinium.pdf.netcore.

Disclaimer: I work for the company the develops XFINIUM.PDF library.

  • Thank you, but it's for a free, very small and open source project, and I cannot afford this kind of fees – J4N Apr 20 '17 at 3:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.