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.
Related
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?
I want to select a file and display its contents as it is in the browser. Can anyone suggest me how to do this?
Here is a library that reads contents of csv file and displays it as table. It is basically a class. if you have object oriented concepts you can do with it.
View my answer
Codeigniter REST CSV import to mysql
I would like to convert a txt file to excel and then modify certain data inside the excel file and then import this new excel file to a database using PHP. The contents of the excel file, for example, will be with products and prices of them and the modification will be on the prices.
Is this even possible using PHP or I will need something else?
Seems like a rather roundabout way of doing this, but I've had great success with Excel/php with phpExcel. That will get read/write Excel, but putting it into the database will likely require som php coding.
If you're just editing datas in Excell (no formulas ...) you should try csv format ...
I think that you should send a example of your txt file ...
Mimiz
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.
I need to implement a functionality where a user can upload an Excel file, that is, .xls file and i need to write a function that will read that file and then save the values in a table, compare them to values in another table and then print some kind of billing quotation.
From what I have read, it seems that the best way to do that is to first convert that file to an xml file and then write a function to parse that xml file.
I want to know, is it possible to write a function in php that will convert an xls file to xml. Assuming that the users will save and upload the file as xls.
Thanks.
i often let admin users upload a csv file they exported from an xcel file, its much simpler to parse through using http://php.net/manual/en/function.fgetcsv.php
A quick Google search for "PHP excel parser" turns up PHP Excel Reader, for an open source library to use for reading data from .xls files. There may be others that suit your needs.
I have been successfully using the 'ABC Excel Parser Pro' from Zakkis.
This allows converting from a XLS file directly into a MySQL table.
A few notes on limitations:
column count must match exactly to database columns
Excel 2007 format (xlsx) are not supported