Create a PDF file taking huge data from MySQL using PHP


I want to make a PDF file which will contain huge data such as 12 months data. Each month contain 500 rows from MySQL table. I have tried with FPDF but it takes too much time that is unacceptable. If there is any other better PHP library or class to make it easily and not make the system busy?

If there is any script which will take 12 months data one month by one month and write it to PDF one by one and finally create the PDF file?

I routinely create very large PDFs from PHP using (usually) the same method. First I create a web page version of the document and output that to a file. Then I run the file through wkhtmltopdf. I've had consistently more success with this method than any other. The HTML should be quick to generate and wkhtmltopdf is surprisingly fast and efficient. Plus you can use CSS3 techniques for elaborate formatting.

For extremely large PDFs I've also generated smaller ones and then merged them with pdfmeld. This also gives you the option of adding bookmarks.