我使用dompdf創建了一個PDF文件,該文件被創建爲即時創建的PDF文件,其唯一目的是作爲PDF生成器的輸入,但是我遇到了麻煩這一點,我實現了代碼this thread,一切工作正常(我可以輸出一個簡單的PDF),但是當我嘗試給它一個更具體的網址我得到這個錯誤:使用CodeIgniter生成PDF
An Error Was Encountered Unable to load the requested file
下面是有問題的代碼:
function printPDF(){
//write_file() usa un helper (file)
$this->load->library('table');
$this->load->plugin('to_pdf');
// page info here, db calls, etc.
$query = $this->db->get('producto');
$data['table'] = $this->table->generate($query);
$path_url = base_url().'print/existencias.html';
write_file($path_url, $data['table']);
$html = $this->load->view($path_url, 'consulta', true);
pdf_create($html, 'consulta');
}
在這裏你可以找到很好的庫 http://stackoverflow.com/questions/9707967/convert-htmlcss-to-pdf-using-codeigniter – Buddhi 2012-10-03 12:23:40