title: Extracting text from a PDF file
body: <p>I'm using PDFBox for a C# .NET project. and I'm getting a "TypeInitializationException" (The type initializer for 'java.lang.Throwable' threw an exception.) when executing the following block of code :</p>
  
  <pre><code>  FileStream stream = new FileStream(@"C:\1.pdf",FileMode.Open);
  
    //retrieve the pdf bytes from the stream.
    byte[] pdfbytes=new byte[65000];
  
    stream.Read(pdfbytes, 0, 65000);
  
   //get the pdf file bytes.
   allbytes = pdfbytes;
  
   //create a stream from the file bytes.
   java.io.InputStream ins = new java.io.ByteArrayInputStream(allbytes);
   string txt;
  
   //load the doc
   PDDocument doc = PDDocument.load(ins);
   PDFTextStripper stripper = new PDFTextStripper();
  
   //retrieve the pdf doc's text
   txt = stripper.getText(doc);
   doc.close();
  </code></pre>
  
  <p>the exception occurs at the 3rd statement : </p>
  
  <pre><code>PDDocument doc = PDDocument.load(ins);
  </code></pre>
  
  <p>What can I do to solve this ?</p>
  
  <p>This is the stack trace :</p>
  
  <pre><code>           at java.lang.Throwable.__&lt;map&gt;(Exception , Boolean )
     at org.pdfbox.pdfparser.PDFParser.parse()
     at org.pdfbox.pdmodel.PDDocument.load(InputStream input, RandomAccess scratchFile)
     at org.pdfbox.pdmodel.PDDocument.load(InputStream input)
     at At.At.ExtractTextFromPDF(InputStream fileStream) in
   C:\Users\Administrator\Documents\Visual Studio 2008\Projects\AtProject\Att\At.cs:line 61
  </code></pre>
  
  <p>Inner Exception of the InnerException :</p>
  
  <ul>
  <li>InnerException  {"Could not load file or assembly 'IKVM.Runtime, Version=0.30.0.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58' or one of its dependencies. The system cannot find the file specified.":"IKVM.Runtime, Version=0.30.0.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58"}    System.Exception {System.IO.FileNotFoundException}</li>
  </ul>
  
  <p>OK, I solved the previous problem by copying some .dll files of the PDFBox to my bin folder. but now I'm getting this error : expected='/' actual='.'--1 org.pdfbox.io.PushBackInputStream@283d742</p>
  
  <p>Are there any alternatives to using PDFBox ? is there any other reliable library out there I can use to extract text from pdf files.</p>