2011-05-18 76 views
1

我目前按照笨this教程,並想知道我怎麼能ezpdf的頁面上添加 圖像到PDF時,manual不上我需要輸入什麼樣的路徑具體規定,我嘗試了一切,PDF只是不加載或顯示圖像。笨和ezPDF添加圖像

僅供參考,我使用下面的代碼添加圖像。

$image = base_url()."system/application/images/logo.jpg"; 
$this->cezpdf->ezImage($image); 
+0

真的沒人?是過時的圖書館? – rax313 2011-05-18 06:22:04

+1

我已經使用fpdf和CodeIgniter,並且取得了巨大的成功。如果你願意使用另一個圖書館,告訴我,這樣我可以開發更深入的答案。 – Cronco 2011-05-18 06:33:45

+0

@Cronco - 我剛剛嘗試過使用它,格式對我來說有點困難,尤其是在爲CodeIgniter結果創建表格時。令人沮喪的是,我需要的僅僅是1張圖片來添加到PDF中,然後我必須重做所有的東西,正因爲如此。 – rax313 2011-05-19 01:41:57

回答

1

我結束了使用fpdf與笨,這裏是我如何添加圖像

function setReportGeneralPageHead($report_name, $print_date){ 
     $this->fpdf->Image(base_url().'system/application/images/somelogo.jpg',10,3,60,0,''); 
     $this->fpdf->Image(base_url().'system/application/images/another-logo.png',225,10,60,0,''); 


     $this->fpdf->SetFont('Arial','',11); 
     $this->fpdf->Cell(140,45,$report_name,'',0,'L'); 
     $this->fpdf->SetFont('Arial','',11); 
     $this->fpdf->Cell(135,45, "Generated on: ".$print_date,'',0,'R'); 
     //$this->fpdf->Line(20, 20, 190, 20); 
     $this->fpdf->Ln(15); 
} 
0

我用site_url()和它的作品對我來說:

$this->cezpdf->ezImage(site_url("image_path")); 

cezpdf fopen S上的網址和將其緩存在臨時目錄中。