Print table in pdf using php [closed] - php

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I want to print mysql database value in tabular format in PDF using php and I want to include header and footer as well on every page of PDF. The problem I face is every last row of the table in PDF is breaks and displays into two parts and the footer is display on another page. So is there any way to stop breaking of a table row which is just above the footer division and print it on another page???
My another question is if I want to give more than one page size in pdf then how can I do it???

You can use any of the below php scripts to generate dynamic PDF documents
FPDF
TCPDF
MPDF
DOMPDF
I have answered it by searching multiple previous stackoverflow answers. You can see them here Link1, Link2,..

You can use tcpdf http://www.tcpdf.org/ for this check the examples here http://www.tcpdf.org/examples.php . All the features required by you are available in this library

Related

Adding footer to a PDF file using PHP [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I want to get a PDF file, add a text to its footer or header save it back using PHP programming language.
Basically, I got a digital e-books library, I want to put a copyright text on each and every page of the pdf books.
Download the TCPDF Library and use the examples to learn
Tcpdf.org
tcpdf header and footer default
Change the values in de header with your own values and save them in a database or something and later get the values from your database

Filling a PDF Form with PHP [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
Im looking to create a new PDF in PHP, given a PDF form template and some PHP variables to input into the PDF template. Whats the best or recommended way of tackling this? Essentially the end goal is that users will fill out this pdf form and there inputs will be saved to a database. Then later being able retrieve the inputs from the database and outputting it to the PDF. Any help with this would be great, Thanks.
You can use a command line tool called pdftk (PDF Toolkit).
See https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/
You can call the command line from php, and the command is
pdftk formfile.pdf fill_form fieldinfo.fdf output outputfile.pdf flatten
You will need to find the format of an FDF file in order to generate the info to fill in the fields.

How to create a PDF file from html using PHP then send it to predefined email? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want a simple html page that takes:
Name - user's time and date and set them in a single paged pdf then send it to a predefined email.
I am a newbie in php can you give me a simple example please?
You need external library. Click here, this pretty much give a good explanation on how to install and how to use the library.
Here is a good example
Use PDF_set_info to set information about the PDF and PDF_show for the actual content. Then if you wish to send it by email use the mail()function, click here for more information and examples.
FPDF is a great library for creating PDF Files. It is open-source (always a plus) and good for creating simple to complex PDF layouts.
You can also check out HTML2FPDF on sourceforge.

retrieve a web page without images [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am writing a web scraper for a specific site using PHP.
I use file_get_contents function to retrieve web pages.
some pages have images and images are also retrieved with the page.
In my case I don't want images to be there. (I want text only)
my question is, is it possible to retrieve pages without images? if so how?
additional info: I have checked the source of the page. there base tag is defined inside head tag and pointing to the same url.
Edit: I just notice images are base64 encoded.
It is not possible to "retrieve" the page with the images not included. You would need to parse/scrub the contents after retrieving it.
Inline with a previous comment, one method (of several) is this way if you simply need the image tags removed:
$data=file_get_contents();
preg_replace("/<img[^>]+>/i", "(image) ", $content);
echo $content;

PDF generation from html pages [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
To generate pdf file from html page I have used libraries like MPDF , FPDF, DOMPDF etc.
In each pdf library I found following issues.
mpdf causes unnecessary page breaks
FPDF needs more writting. etc
When I used DOMPDF it worked fine but large table didn't expanded to next page and pdf broke without generating next pages.
Then I searched for another pdf library and I came to know about TCPDF.
SO I want to know what are the disadvantages of "TCPDF"?
A great alternative for PDF generation is wkhtmltopdf. It has a smooth integration and the result is awesome. You will have to install the binary into your server, though. If you're on a VPS or dedicated, this will not be a problem.
There's a PHP lib for using it, you can find it here: https://github.com/KnpLabs/snappy
Also, there's a nice solution for the large table problem you have. Maybe it can help you with another lib too, take a look here: https://code.google.com/p/wkhtmltopdf/issues/detail?id=566

Categories