Export pdf table data and import it into mysql - php

I want to export table data from pdf file and insert it into mysql database. How can I do it?
Regards,
Rekha

Start by converting the PDF into text. There's a program called pdf2text which you could download and use to do that (through exec for instance). Alternatively, there are several PHP classes which can convert the PDF into text like this one I found for you.
Once you have the text, you'll want to parse the text output and populate the data. You'll most likely want to look at regular expressions.

Related

Insert at word file excel table

I need to generate Word document using PHP. I have html, save it as doc-file, but now I need to insert in this file excel table. How can I do it with html content, or I need some classes to do it?
There is an excellent PHP class for creating Excel documents. It is called php-export-data by Eli Dickinson, http://github.com/elidickinson/php-export-data.
Also you can check this stackoverflow question: Alternative for PHP_excel
However, this is some sort of advanced task, you better be prepared.

Importing data from PDF to Database using PHP

Can we able to read the data from a PDF file to PHP.
We are able to read data from an excel or csv file, that can be directly imported to db using PHP.
Similarly is there any way to read data from a pdf file, and import it to database using PHP.
For Eg:
in a pdf file i have a table employee details
can we able to import that data to db using php..
You can try something like PDF Parser - http://www.pdfparser.org/
This will allow you to extract text from a PDF. From there, you can create a script to parse the extracted text and insert it into your database.

How to create PDF through PHP where data is gathered from MySQL and it is in Rich Text Format

I am extracting Rich Text data from MySQL and want to create a pdf from it. I am able to create a script where I have say only bold, italics, underlined one. It gets a much harder when the data has span tags with text color and background-colors, nesting of lists etc. Is there a way where pdf can be generated by just giving html page as an input? As the data contains tags.
creating PDF using php or any other language doesn't concern with your text format, its upto you will format your text and write on PDF.see THIS
Use MPDF to create your pdf page feom html
http://www.mpdf1.com/mpdf/index.php
you could use a third party HTML to PDF api like PDFCrowd

Using PHP to read text from a PDF stored in mysql

I am trying to use PHP to read the text from a PDF file that is stored in a mysql database. I tried using class.pdf2text.php, which works with an actual file. I tried to use the MYSQL_RESULT variable with the pdf file contents with that class, but it doesn't work. I've got to be missing something really easy, I just know it.
Basically, this is what I'm trying to do:
I have a database with PDF files. I need to convert a PDF from that database to text and then search on that text for certain data. Is there a way to do this without creating external files in PHP?

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?
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.
I often use the FPDF library to create PDF documents via a PHP script. Plenty of examples and documentation here: http://www.fpdf.org/
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.

Categories