问题描述
我正在使用CodeIgniter和 R& OS pdf类生成PDF文件.但是现在的问题是,pdf显示在浏览器中.相反,我希望将其下载.这是我的代码:
I am generating PDF file using CodeIgniter and R&OS pdf class.But now the problem is that the pdf is displayed to the browser.I instead want it to be downloaded.Here is my code :
$this->load->library('cezpdf');
$data['users'] = $this->user->get_all_ayant_droits();
foreach($data['users'] as $user) {
$db_data[] = array('name' => $user->nom, 'department' => $user->Department, 'status' => $user->Status);
}
$col_names = array(
'name' => 'Noms et Prenoms',
'department' => 'Département',
'status' => 'Status'
);
$this->cezpdf->ezTable($db_data, $col_names, 'Ayant droit Base Loisirs de Kribi', array('width'=>550));
$this->cezpdf->ezStream();
此控制器发送文件下载缺少什么?
What is missing for this controller to send the file to download ?
推荐答案
您可以将参数传递给函数ezStream
You can pass the argument to the function ezStream
$this->cezpdf->ezStream(array $options);
$options 'compress' => 0/1
启用压缩.对于压缩级别,请在第一点使用$this->options['compression'] =
.默认值:1'download' => 0/1
显示嵌入式(在浏览器中)或下载.默认值:0
$options 'compress' => 0/1
to enable compression. For compression level please use $this->options['compression'] =
at the very first point. Default: 1'download' => 0/1
to display inline (in browser) or as download. Default: 0
这篇关于下载PDF文件,而不是使用CodeIgniter进行显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!