tags:

views:

146

answers:

3

I have a PDF document that contains data that I would like to extract and store in a MySQL database. Could anyone give me some guidance or perhaps sample PHP code?

A: 

I often use the FPDF library to create PDF documents via a PHP script. Plenty of examples and documentation here: http://www.fpdf.org/

rascher
But the OP doesn't want to generate PDFs, he wants to read them.
Josh Leitzel
okay. this was not obvious from the first version of the post!
rascher
A: 

What do you wanna do ?

If you want to store the PDF in a MySQL database, i recommand you to store the pdf in a directory and the path to the pdf in the mysql database. Or you can store file_get_contents($pathToThePDF) in the db but I don't think it's a good idea.

If you want to create with PHP a PDF with data from a MySQL db, i also use fpdf (like rascher) to do that and it works well + there are many example on the website.

p4bl0
Okay thanks EBGreen, I think schatzie should take a look at Zend_PDF, maybe it could do that kind of thing since it's able to open a pdf and then modify it.
p4bl0
A: 

There's some basic code here for performing text extraction from a PDF. Might work for you. For commercial libraries, check out pdflib which I believe can do similar extraction.

Once you have the data, it's up to you to massage that into MySQL INSERT statements to create your database.

Paul Dixon