php - 如何使用 dompdf 在 codeigniter 中查看 pdf 文件?
问题描述
我不知道如何查看 pdf 文件。它会自动下载而不是在浏览器中查看。
这是我的代码
public function index(){
$data_user['users'] = $this->db->get('tbl_client')->result();
$this->load->view('Dashboard/Print/user_list', $data_user);
$html = $this->output->get_output();
$this->load->library('pdf');
$this->dompdf->loadHtml($html);
$this->dompdf->setPaper('A4', 'landscape');
$this->dompdf->render();
$this->dompdf->stream("mypdf.pdf");
}
SOLVED! With the answer below..
如果仍然面临这个问题。确保您没有使用任何下载管理器。
解决方案
希望这可以帮助
$this->dompdf->stream("mypdf.pdf", array("Attachment" => 0));
exit(0);
推荐阅读
- bukkit - Bukkit 帮助“预期标识符”
- cakephp-3.8 - 为什么我的插件没有在生产中加载?
- node.js - 部署时 AppEngine Flex Node.js 超时错误 4
- html - 填充以包含包装器中的文本
- python - 我遇到错误“TypeError:'int' object is not iterable”
- flutter - 如何在 Flutter 中对数字进行四舍五入?
- gradle - Jhipster 实体子生成器:如何使用 gradle 在 Prod 中创建 liquibase DELTA 更改日志?
- android - 如何修复错误“'WhereIterable
' 不是类型 'List 的子类型 '" - r - 如何使用 ggplot 对时间进行绘图
- python - 来自 SQL 的 python unicode 格式化