【问题标题】:dompdf exclude menu and footerdompdf 排除菜单和页脚
【发布时间】:2021-05-24 18:09:01
【问题描述】:

嘿, 我使用 dompdf 并在生成 pdf 时,包括“母亲”页面中的相应菜单和页脚。我不知道在哪里编辑代码以排除菜单和页脚。

代码控制器:

  function export_invoice($param1 = 'export' ) {
  $page_data['action']   = $param1;
  $page_data['page_name'] = 'export_invoice';
  $page_data['page_title'] = get_phrase('export_invoice');
  $this->load->view('frontend/'.get_frontend_settings('theme').'/index', $page_data);
  $html1 =$this->load->view('frontend/'.get_frontend_settings('theme').'/index',$page_data, true);
  $html = mb_convert_encoding($html1, 'HTML-ENTITIES', 'UTF-8');
  $this->pdf->loadHtml($html);
  $this->pdf->set_paper("a5", "portrait" ); //landscape
  $this->pdf->render();
  // FILE DOWNLOADING CODES
  $url = current_url();
  $str = substr(strrchr($url, '/'), 1);
  $str1=$str;
 $fileName = 'Invoice-'.$str.'.pdf';
 $this->pdf->stream($fileName, array("Attachment" => 0)); //initial era 1 pentru descarcare si 0 pentru preview in broswer
}

并查看:

<html>
    <head>
        <meta charset="utf-8">
        <title>PDF Output</title>
        <style>
            /* your style here */
        </style>
    </head>
    <body>
        {contents}
    </body>
</html>

Image from pdf

【问题讨论】:

    标签: php html codeigniter


    【解决方案1】:

    我使用 css,它适用于:

    .menu-area{display: none;}
    

    【讨论】:

      猜你喜欢
      • 2012-03-07
      • 1970-01-01
      • 2012-02-26
      • 1970-01-01
      • 2017-01-31
      • 1970-01-01
      • 2012-06-03
      • 2011-06-19
      • 2013-09-05
      相关资源
      最近更新 更多