mPDF在codeigniter中进行横向打印

时间:2016-10-04 06:41:26

标签: php codeigniter pdf mpdf

我一直在尝试使用mPDF和codeigniter打印PDF。这个PDF以及应用程序中的所有其他打印都很好,但我无法打印它。

我已经尝试了其他问题中建议的所有参数组合,但它们都没有对打印产生任何影响。因此,我实现mPDF库的方式有问题。

我现在的控制人员:

$filename = $order_number;
    $pdfFilePath = FCPATH."/downloads/orders/$filename.pdf";
    $data['page_title'] = 'Order';
    if (file_exists($pdfFilePath) == TRUE)
    {
        unlink($pdfFilePath); 
    }
    if (file_exists($pdfFilePath) == FALSE)
    {
        ini_set('memory_limit','128M'); // boost the memory limit
        $html = $this->load->view('generate_pdf', $data, true); // render the view into HTML
        $this->load->library('pdf2');
        $pdf2 = $this->pdf2->load();
        $pdf2->WriteHTML($html); // write the HTML into the PDF
        $pdf2->Output($pdfFilePath, 'F'); // save to file because we can
    }

mPDF库:

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Pdf2 {

function pdf2()
{
    $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-L","","",10,10,10,10,6,3';
        //$param = '"en-GB-x","A4","","",10,10,10,10,6,3',L;
        //$param = '"en-GB","A4-L"';
        //$param = '"L"';
        //$param = '\'en-GB-x\',\'A4-L\',\'\',\'\',10,10,10,10,6,3,L';  
    }
    //echo $param;
    return new mPDF($param); 
}
}

mPDF是忽略这些参数还是我错了?

0 个答案:

没有答案