Skip to content

Instantly share code, notes, and snippets.

@qwersk
Created August 22, 2017 10:45
Show Gist options
  • Save qwersk/e01ef70494f4cb9d43385b520e0f8161 to your computer and use it in GitHub Desktop.
Save qwersk/e01ef70494f4cb9d43385b520e0f8161 to your computer and use it in GitHub Desktop.
GENERATE PDF #PHP
<?php
// https://github.com/mpdf/mpdf
$stylesheet = file_get_contents(JPath::clean(JPATH_BASE.'/media/teachers/tmpl/pdf_curator.css'));
//$stylesheet .= file_get_contents(JPath::clean(JPATH_BASE.'/media/teachers/tmpl/pdf_license_print.css'));
$stylesheet .= ' @page{'.$bg_style.'background-image-resolution:300dpi;background-image-resize:1;}';
$mpdf->CSSselectMedia = 'pdf';
include(JPath::clean(JPATH_BASE.'/media/mpdf/6.0/mpdf.php'));
$mpdf = new mPDF('utf-8', 'A4', '8', '', 0, 0, 0, 0, 0, 0);
$mpdf->charset_in = 'utf-8';
$mpdf->WriteHTML($stylesheet, 1);
$mpdf->SetDisplayMode('fullpage');
$mpdf->list_indent_first_level = 0;
$mpdf->WriteHTML($html, 2);
$mpdf->Output('license.pdf', $dest);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment