Blank Output PDF using FPDF library - codeigniter

我怕爱的太早我们不能终老 提交于 2019-12-02 05:32:46

I had the same problem and this was my solution:

Instead of using

$this->fpdf =new FPDF() 

I used

$pdf = new FPDF();

then u can use $pdf->... and not $this->pdf->...

Here is an example:

define('FPDF_FONTPATH',$this->config->item('fonts_path'));
$this->load->library(array('fpdf','fpdf_rotate','pdf'));
$this->pdf->Open();
$pdf = new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Arial', '', 12);
$pdf->SetDrawColor(0);
$pdf->MultiCell(100,5,"Test\n line of text");
$pdf->Output('test.pdf', 'D');

Works like a charm ;)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!