This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Filling PDF Forms with PHP
I have been looking and testing this for a couple days now and was wondering if anyone could point me in a different direction. I have a very long job application HTML form (jobapp.html) and a matching PDF (jobpdf.pdf) that have the same field names for all entries in both the HTML form and the PDF. I need to take the user data that is entered in the form and convert it to a PDF. This is what I have gathered so far but don't know if I am on track:
Is pdftk the only viable 3rd party app to accomplish this?
Using pdftk would i take the $_POST data collected for the user and generate a .fdf(user.fdf) then flatten the .fdf on the .pdf(job.pdf). So irregardless of where the fields are located on each document the information on the fdf would populate the pdf by field names?
Try mPDF. It generates PDFs from HTML and CSS. It doesn't understand everything you might want, but for documents with relatively simple formatting it's good.
Related
This question already has answers here:
Create PDF pages in PHP
(2 answers)
Closed 9 years ago.
If I missed a similar question, I'm truly sorry - I have done what I believe to be quite a bit of digging on this subject and come up empty handed.
Is it possible (or practical) to do one of the following:
1) Use the data from a web form to populate fields in a PDF?
or 2) Simply upload the PDF and allow the user to complete and submit it online?
I don't necessarily have a preference between the two, other than the most practical solution.
mPDF is a PHP class which generates PDF files from UTF-8 encoded HTML. It is based on FPDF and HTML2FPDF, with a number of enhancements.
check it out MPDF1
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Create a PDF file with PHP
I have created invoice generator using javascript. well I am able to work on it. Now what I have to do is I have to generate the data in the pdf which are available in the invoice. I tried some but none work out. So If there is anyone who can help me out?
Thanx in advance
I have used "webkit html to pdf" (wkhtmltopdf) several times.
It worked well for me, although working with page breaks is a bit of an hassle.
PDF cannot be generated at the client side (I mean with Javascript). You will need to process the invoice data at the server side using a PDF library and write to a URL location, so that it can be downloaded or opened in a browser.
TCPDF is a good tool to generate PDF with PHP. See this link.
Also see this question.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How can I export tables to excel from a webpage
EDIT: Just to clarify, it does not HAVE to be an Excel file, but it has to be a spreadsheet file which is able to be opened/edited in Excel.. So whatever would accomplish this most easily is the answer I seek :)
I need to convert an HTML table to some sort of downloadable spreadsheet (preferably for Office Excel). I can do this in jQuery, but would prefer to do it in plain JavaScript. I've searched around and have found a lot of info about doing the reverse (spreadsheet->html), but I need to create a downloadble spreadsheet file of a dynamically built table. Any points for how I could accomplish this would be much appreciated! :)
Don't do this in JavaScript. You need to do this in a server-side scripting language like PHP.
The easiest way to prepare data for importing into a spreadsheet is going to be creating a CSV file. Here's an example CSV file which will open fine in Excel:
column_a,column_b
1,2
5,7
8.988,abcdef
CSV files are just plain text, with the fields separated by commas, so they are easy to create. If the data in your fields needs to contain commas, double quote marks, newlines, or a few other special cases, then things get more tricky.
If you really want to create an Excel-format spreadsheet, this is pretty difficult and you're going to want the help of a library. Here's how I would find a PHP Excel library: http://google.com/search?q=php+create+excel+spreadsheet
You can't do this with JavaScript because it cannot create a downloadable file.
You must do this on the server. Any HTML page that is a table will automatically be converted BY EXCEL ITSELF if you send out the correct MIME header before streaming out the HTML file.
You can't do it all in Javascript. You can write a jQuery function to convert a table to something like a CSV format, but you won't be able to tell the browser to let the user download it. You'll have to POST it to a server which can then serve back the file.
See this question for details.
I can be mistaken, but it may be possible using data: URI scheme
<a href="data:text/csv;charset=utf8;base64,...encoded_data...">
download as Excel
</a>
It is not cross-browser, but can help.
there is one website which is providing case studies to download.
In that website i have to first login. Than search for the pdf using one form like selecting dates, type etc.. and than it gives list of pdfs. so on clicking the link it opens the pdf.
Now what i want to do is, automatize this process. I will have one interface to directly select the dates, types etc.. and than it directly prompts me to save the excel file.
Using php i want to automatize the above given process and once i open the pdf. i want to parse the pdf and than copy the selected items in csv.
can anyone tell me how to do all this using php..
This should probably be two questions.
The answer to the first part of your question can be found in the SO question: Is there a PHP equivalent of Perl's WWW::Mechanize?
The answer for the second part of your question can be found in the SO question: Is there a PDF parser for PHP?
I have tried googleing this but can't seem to find an answer.
I have a client that has hundreds of PDF files, each of them have a form with any number of text-fields within them... it could range anywhere from 2 text-fields to 30 text-fields... that is an unknown.
What I need to do is read the PDF file, find all of the text-fields (including field names) within the PDF file so that I can dynamically generate a HTML form that an user will complete which then populates the PDF form.
How can I get a list of text fields and their names within a PDF document using PHP?
There are few tools to work on PDFs that are natively written in PHP.
You might however be able to run the pdftk binary to accomplish this task:
$fields = `pdftk input.pdf dump_data_fields`;
Not tried since I don't have a PDF with forms handy. But supposely you get a textual result list as described here: http://www.cs.unb.ca/~bremner/blog/posts/filling_in_forms_with_pdftk/