Skip to content

Instantly share code, notes, and snippets.

@ravinsharma12345
Created January 3, 2014 05:41
Show Gist options
  • Save ravinsharma12345/8233410 to your computer and use it in GitHub Desktop.
Save ravinsharma12345/8233410 to your computer and use it in GitHub Desktop.
Getting Started:Dompdf example
require_once get_template_directory().'/dompdf/dompdf_config.inc.php';
$dompdf = new DOMPDF();
$filename = 'massdata_stock_reservation_report_'.date('Y M d').'.pdf';
$filename = sanitize_file_name($filename);
$report_path = get_template_directory().'/'.$filename;
$dompdf->load_html($html);
$dompdf->render();
$pdf = $dompdf->output();
file_put_contents($report_path, $pdf);
if(is_readable($report_path)){
wp_mail(get_option('admin_email'), 'Massdata Stock Report', "Monthly report of massdata system stock reservation. \nPlease open the attachment for the report.", '', $report_path);
unlink($report_path);
}
$html = <<<'ENDHTML'
<html>
<head>
</head>
<body>
<h1>Jello!!!!</h1>
</body>
</html>
ENDHTML;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment