duanbinian2243 2014-10-27 12:04
浏览 24

如何在ci中创建任何大小的pdf文件

I use dompdf to create pdf files from database query in ci. If I limit the rows to about 500 records then it works fine.

The problem is I have more than 5000 records and it gives me time out.

My controller method is as below:

public function loadPDFReports() {
    ini_set ( 'memory_limit', '1024M' );
    $data ['reports'] = $this->Red_model->loadPDFReports ();
    $size = sizeof ( $data ['reports'] );
    $all = array_chunk ( $data ['reports'], 400 );
    foreach ( $all as $chunk ) {
        $data1 ['reports'] = $chunk;
        $data1 ['page_num'] = $PAGE_NUM;
        echo "hussain: <pre>";
        print_r ( $chunk );
        $view = $this->load->view ( 'reports/pdf', $data1, TRUE );
        pdf_create ( $view, 'filename' );
    }
    $view = $this->load->view ( 'reports/pdf', $data, TRUE );
    pdf_create ( $view, 'filename' );

} // loadPDFReports()

As you see in the code commented, i tried to split the data into separate 400 rows each,but it works only for the first loop.

It is to mentioned that I have already loaded the dompdf helper in autoload.php.

  • 写回答

1条回答 默认 最新

  • dongyang7152 2015-05-11 09:08
    关注

    You can use : Increase your server max_execution_time

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度