与使用CODEIGNITER的其他页面相比,mPDF在第一页中创建的页边距更高

时间:2016-12-28 16:30:43

标签: codeigniter mpdf

在这里,我将提供创建发票的代码所有事情都没有问题,只是PDF在首页上比其他页面有更多的余量。

function createInvoice($invoiceId) {
        ini_set('memory_limit', '256M');
        // load library
        $this->load->library('pdf');
        $pdf = $this->pdf->load();
        // $pdf->useAdobeCJK = true;   
        // $pdf->SetAutoFont(AUTOFONT_ALL);
        // retrieve data from model
        $data['invoice'] = $this->reports_model->retInvoice($invoiceId);
        $data['items'] = $this->reports_model->retItems($invoiceId);
        $data['title'] = 'بل';

        $pdf->SetHTMLHeader('<div style="text-align: right; font-weight: bold; "></div>','O');

        $pdf->SetHTMLHeader('<div style="border-bottom: 1px solid #000000;"></div>','E');

        $pdf->SetHTMLFooter('<table style="vertical-align: bottom; font-family: serif; font-size: 8pt; color: #000000; font-weight: bold; font-style: italic;"><tr>
                             <td style="font-weight: bold; font-style: italic; border: none;">{PAGENO}/{nbpg}</td>
                             </tr></table>');
        $pdf->SetHTMLFooter('<table style="vertical-align: bottom; font-family: serif; font-size: 8pt; color: #000000; font-weight: bold; font-style: italic;"><tr>
                             <td align="left" style="font-weight: bold; border: none; font-style: italic;">{PAGENO}/{nbpg}</td>
                             </tr></table>', 'E');

        $pdf->AddPage('', // L - landscape, P - portrait 
            '', '', '', '',
            12, // margin_left
            12, // margin right
            30, // margin top
            30, // margin bottom
            0, // margin header
            0); // margin footer
        // boost the memory limit if it's low ;)
        $html = $this->load->view('reports/invoice', $data, true);


        // render the view into HTML
        $pdf->WriteHTML($html);
        // write the HTML into the PDF
        $output = $invoiceId . '--' . date('Y_m_d_H_i_s') . '_.pdf';
        $pdf->Output("$output", 'I');   
    }

请帮忙 所有帮助将不胜感激。 感谢。

0 个答案:

没有答案
相关问题