If you want to do this in code, look at HTML2PDF or FPDF, these are php libraries designed to create PDF documents with code.
If you combine HTML2PDF with PHP output buffering functions, i.e.
<?php ob_start(); ?> // put all your html in here <?php $data = ob_get_contents(); require('html2pdf.php'); $pdf = new HTML2FPDF(); $pdf->AddPage(); $pdf->WriteHTML($data); $pdf->Output(); ?>
Obviously this is a very crude example, but I used it before in php to create PDF files. He has some problems with styles, they seem to ignore most of them. But more control can be gained by using FPDF yourself and manually creating documents.
source share