schatzie
schatzie

Reputation: 21

How to extract data from a PDF and store in MySQL

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?

Upvotes: 0

Views: 6596

Answers (3)

Paul Dixon
Paul Dixon

Reputation: 300835

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.

Upvotes: 1

p4bl0
p4bl0

Reputation: 3906

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.

Upvotes: 0

poundifdef
poundifdef

Reputation: 19353

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

Upvotes: 0

Related Questions