我在CodeIgniter中使用mPDF.
这是我的lib(pdf.php)
class pdf {
function pdf()
{
$CI = & get_instance();
log_message('Debug', 'mPDF class is loaded.');
}
function load($param=NULL)
{
include_once APPPATH.'/third_party/mpdf/mpdf.php';
if ($params == NULL)
{
$param = '"en-GB-x","A4","","",10,10,10,10,6,3,"L"';
}
return new mPDF($param);
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的控制器
$filename = 'qwerty';
//...
// As PDF creation takes a bit of memory, we're saving the created file in /downloads/reports/
$pdfFilePath = FCPATH."reports\\" . $filename . ".pdf";
//$data['page_title'] = 'Hello world'; // pass data to the view
for($i=0;$i>=0;$i++)
{
if(file_exists($pdfFilePath) == TRUE) …Run Code Online (Sandbox Code Playgroud)