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 an product called MPDF http://www.smaizys.com/php/mpdf-html-to-pdf-introduction.
$htmlfile = "myfile.html";
$pdffile = "myfile.pdf";
$htmlGen = file_get_contents($htmlfile);
$mpdf = new mPDF();
$stylesheet = file_get_contents('css/PageStyleResults.css');
Using the F switch in the output allowed me save a copy of the PDF, which I then send out by email.