+1 vote
1.1k views
in Programming by Expert (5.1k points)
I want to extract emails or a particular text from the pdf files in php.Please suggest me some well class or lib.

Thanks!

2 Answers

0 votes
by
if you are referring to parsing a pdf with php, yes and no. I've never heard of php being able to do this natively, but there are libraries / plugins available for this.
in my experience I have mostly just built pdf's from html so I may be wrong.
0 votes
by

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:

include('class.pdf2text.php');
$a = new PDF2Text();
$a->setFilename('test_RFP.pdf'); //give the file name with path
$a->decodePDF();
echo $a->output(); 

 

I hope this will help you , because when I was testing this  code it was not working for some of pdfs.

0
by Expert (5.1k points)
thanks for your answer , But I have already tried this , its not working
0
by (1.3k points)
if you want to extract data FROM a PDF file then you need some sort of PDF Parser, I would recommend https://github.com/smalot/pdfparser

Not a Member yet?

Ask to Folks Login

My Account

Your feedback is highly appreciated