如何处理Codeigniter PDF生成器 [英] How to handle a codeigniter PDF generator

查看:77
本文介绍了如何处理Codeigniter PDF生成器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在视图页面"ShowInformation.php"中,我有类似这样的代码,包括省略的CSS样式代码和其他内容

In the view page "ShowInformation.php" I have the code something like this including the omit css style code and other stuff

<?php foreach ($preUser as $value): ?>

Citizen ID : <?php echo $value->cid;?></br>
First Name : <?php echo $value->name;?></br>
...

<?php endforeach; ?>

$ preUser是从控制器及其数据库传递的变量.

$preUser is a variable passing from the controller and its from database.

我需要在该页面中添加下载按钮,并使用完全相同的PHP/HTML/CSS生成PDF,以支持UTF-8.

I need to add the download button in that page and generate the PDF with exact the same PHP/HTML/CSS, supporting UTF-8.

有什么建议吗?

推荐答案

我工作过的哇 但是我怀疑这是最好的方法吗?

WOW I worked but I have my doubts this is the best way?

CI 2.1.3

public function mostrar()
{       
    require_once(APPPATH.'third_party/html2pdf/html2pdf.class.php');

    //vista template pdf
    $template_pdf = $this->load->view('pdf_mostrar', '', TRUE);


    $html2pdf = new HTML2PDF('P','A4','fr');
    $html2pdf->WriteHTML($template_pdf);
    $html2pdf->Output('exemple.pdf');   
}

这篇关于如何处理Codeigniter PDF生成器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆