Read Pdf file using c#

So you’ll have to download the PDFBox package. In this package you’ll find a bin directory. To read your PDF file, you’ll need the following files:

* IKVM.GNU.Classpath.dll
* PDFBox-0.7.3.dll
* FontBox-0.1.0-dev.dll
* IKVM.Runtime.dll

PDF Box Package is free distribution tool







You’ll have to add a reference to the first two in your project. You’ll also have to copy the last two on your project’s bin directory.


The program will look something like this (if you’re working with a Console application):



using System;
using org.pdfbox.pdmodel;
using org.pdfbox.util;
namespace PDFReader

{
class Program
{
static void Main(string[] args)
{
PDDocument doc = PDDocument.load("lopreacamasa.pdf");

PDFTextStripper pdfStripper = new PDFTextStripper();

Console.Write(pdfStripper.getText(doc));
}

}

}

0 comments :

Post a Comment