pdfbox issue
I used pdfbox to extract text from PDF to my richtextbox.
I don't know what's the problem but there are PDF that are good but there are PDF that throws an exception, the exception is:
Object reference not set to an instance of an object.
Here's my code:
using org.pdfbox.pdmodel;
using org.pdfbox.util;
private void pdfButton_Click(object sender, EventArgs e)
{
    OpenFileDialog openFD = new OpenFileDialog();
    openFD.FileName = "";
    openFD.InitialDirectory = "C:\\";
    openFD.Filter = "All PDF Files|*.PDF";
    openFD.Title = "Browse all PDF files";
    if (openFD.ShowDialog() == DialogResult.OK)
    {
        try
        {
            pdf_filename = Path.GetFileNameWithoutExtension(openFD.Filename);
            PDDocument pdfFile = PDDocument.load(openFD.Filename);
            PDFTextStripper pdfStripper = new PDFTextStripper();
            richtextBox1.Text = pdfStripper.getText(pdfFile);
            textBox1.Text = Path.GetFileName(openFD.Filename);
        }
        catch (Exception error)
        {
            MessageBox.Show(error.ToString());
        }
    }
}
 
    