Created
January 3, 2014 05:41
-
-
Save ravinsharma12345/8233410 to your computer and use it in GitHub Desktop.
Getting Started:Dompdf example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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