I have recently found the need to generate a PDF from the content of a dynamic HTML page.
I found a really useful product that allowed me to change the PDF layout via CSS, which allowed me to have a coloured back ground on my page, but have a white background on my PDF.
I used a product called MPDF http://www.smaizys.com/php/mpdf-html-to-pdf-introduction.
$htmlfile = "myfile.html";
$pdffile = "myfile.pdf";
//PDF Generation
$htmlGen = file_get_contents($htmlfile);
require_once('MPDF57/mpdf.php');
$mpdf = new mPDF();
$stylesheet = file_get_contents('css/PageStyleResults.css');
$mpdf->WriteHTML($stylesheet,1);
$mpdf->WriteHTML($htmlGen);
$mpdf->Output($pdffile, 'F');
Using the F switch in the output allowed me save a copy of the PDF, which I then send out by email.