You can follow these steps :
Step 1. create a file with the name class.pdf2text.php
Now paste the code below in this file:
Paste code from here
Step 2. In a another file just write the below code:
$a = new PDF2Text();
$a->setFilename('test_RFP.pdf'); //give the file name with path
I hope this will help you , because when I was testing this code it was not working for some of pdfs.