标签: dompdf

如何使用dompdf生成目录?

我正在使用php的dompdf库从HTML模板生成PDF报告。在该html模板中,有一个目录部分。生成PDF时,我需要更新目录的页码。有谁知道我如何在php的dompdf库中实现这一目标?

提前致谢。

php report dompdf

5
推荐指数
1
解决办法
3591
查看次数

DOMPDF:无法传输已发送的pdf:标头

各种论坛已经提出了这个问题数百次; 有些已经解决了,有些则没有.我检查了大量资源,但我的问题无法解决.我正在使用基于html表单输入和上传文件的smarty模板生成php页面.使用dompdf,我想将生成的页面保存为pdf文件.当用户提交multipart/form-data时,数据将发布到自身.然后它经历验证过程.当一切正常时,使用模板文件生成新页面.没有输出,相反,dompdf利用模板文件来传输pdf文件.在解决了几个阶段的问题,例如"未找到DOMPDF",内存不足等问题之后,我现在仍然遇到"无法流式传输pdf:已发送的标头"错误.最常见的问题之一是存在断线,调用stream()之前的空格或任何输出.我前后检查了空白区域?还有print_f或echo语句.我该如何解决这个问题?问题在哪里......在smarty模板文件或php文件本身?这是代码:

require_once("dompdf/dompdf_config.inc.php");
spl_autoload_register('DOMPDF_autoload');
$html = $smarty->fetch('index.tpl');
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->set_paper('a4', 'portrait');
$dompdf->render();
$dompdf->stream("newfile.pdf");
Run Code Online (Sandbox Code Playgroud)

php smarty dompdf

5
推荐指数
2
解决办法
2万
查看次数

dompdf"超过30秒的最大执行时间"

一致(意思是每次)我尝试将相对大量的与客户端表单相关的HTML加载到dompdf中我得到主题错误消息,或者偶尔会出现一些其他错误.如果我注释掉PDF文档中9页的任何一个代码,它就可以了.一旦达到某个不确定的临界质量数据,我在过去的变长报告(这是一个总是9页的表格)中遇到了同样的问题.我见过的与此问题相关的其他帖子总是包括后续评论,坚持原始海报提供HTML.我试图这样做,但它远远超过允许的限制.为了减少HTML的数量会导致dompdf渲染没有问题的HTML,所以我不知道如何继续获得解决方案.我可以提供指向该页面的链接,但它需要用户名和密码才能访问,结果页面将包含不供公众使用的信息.如果没有任何帮助,可以有人建议我可以获得帮助的另一个论坛吗?

以下是我可以列出的HTML的一些细节,可能有助于诊断问题:它几乎完全使用HTML表构建.这些表都不跨越多个页面.没有textarea控件.

php pdf rendering cakephp dompdf

5
推荐指数
3
解决办法
1万
查看次数

如何在dompdf中应用引导样式

我正在使用引导网格来显示,我希望我的客户端以pdf格式下载它,因此我正在使用dompdf,但dompdf无法应用引导样式。我无法返回并将引导网格转换为基本的html表,并使用其他插件将其转换为pdf,我发现它们既困难又耗时(尤其是在安装作曲机然后更新我是new的过程中),因此我可以轻松地将引导样式应用于我的pdf

   $pr_dt=$_POST['hid'];//div elements which i want ot convert them to pdf and also contain bootstap lib link
   include_once("../assets/converter/dompdf/dompdf_config.inc.php");
   $dompdf =  new DOMPDF();
   $dompdf->load_html($pr_dt);
   $dompdf->render();
   $dompdf->stream("MRA.pdf");
Run Code Online (Sandbox Code Playgroud)

或至少有任何在线转换器将引导网格转换为html表

php jquery pdf-generation dompdf

5
推荐指数
1
解决办法
2万
查看次数

带有特殊字符的 dompdf

我有以下代码:

\n\n
$pdf = \\App::make(\'dompdf\');\n$pdf->loadView(\'offers.pdf\',compact(\'email\',\'messages\'));\nreturn $pdf->stream();\n
Run Code Online (Sandbox Code Playgroud)\n\n

pdf.blade.php:

\n\n
<!doctype html>\n<html class="no-js" lang="sk">\n<head>\n    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\n    <title></title>\n    <style type="text/css">\n        * {\n            font-family: "Arial";\n        }\n    </style>\n</head>\n<body>\nRozpo\xc4\x8det, Volite\xc4\xben\xc3\xa9 \xc4\x8dasti\n</body>\n</html>\n
Run Code Online (Sandbox Code Playgroud)\n\n

PDF 文档如下所示:

\n\n
Rozpo?et,Volite?n\xc3\xa9 ?asti\n
Run Code Online (Sandbox Code Playgroud)\n\n

但我需要显示文件中的特殊字符pdf.blade.php,你有什么解决方案吗?

\n

special-characters dompdf laravel-5

5
推荐指数
1
解决办法
3635
查看次数

cellmap中找不到Frame的解决方法

下列:

在单元格图中找不到框架

https://github.com/dompdf/dompdf/issues/657

是互联网上众所周知的问题。但我找不到问题的解决方案。我正在尝试将我的 html 模板转换为 pdf。当我删除它时,<table>它正在工作。否则它会抛出异常。

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Example 2</title>
    <link rel="stylesheet" href="/administration/style.css" media="all" />
  </head>
  <body>
    <header class="clearfix">
      <div id="logo">
        <img src="/administration/logo.png">
      </div>
      <div id="company">
        <h2 class="name">Company Name</h2>
        <div>455 Foggy Heights, AZ 85004, US</div>
        <div>(602) 519-0450</div>
        <div><a href="mailto:company@example.com">company@example.com</a></div>
      </div>
      </div>
    </header>
    <main>
      <div id="details" class="clearfix">
        <div id="client">
          <div class="to">INVOICE TO:</div>
          <h2 class="name">John Doe</h2>
          <div class="address">796 Silver Harbour, TX 79273, US</div>
          <div class="email"><a href="mailto:john@example.com">john@example.com</a></div>
        </div>
        <div id="invoice">
          <h1>INVOICE 3-2-1</h1>
          <div class="date">Date of …
Run Code Online (Sandbox Code Playgroud)

php dompdf laravel

5
推荐指数
1
解决办法
1万
查看次数

Dompdf错误"找不到块级父级.不好."

require_once("function/dompdf/dompdf_config.inc.php");
$dompdf = new DOMPDF();
foreach($modules as $module){
   $output = "Hello " .$module['name'];
   $dompdf->load_html($output);
   $dompdf->render();
   $output_pdf = $dompdf->output();
   file_put_contents($dir . $name_modulo . ".pdf", $output_pdf);

}
Run Code Online (Sandbox Code Playgroud)

致命错误:未捕获异常'DOMPDF_Exception',消息'找不到块级父级.不好.'

php dompdf

5
推荐指数
5
解决办法
7366
查看次数

通过dompdf用codeigniter生成的pdf电子邮件

我有一个从Codeigniter中的html视图生成的PDF,现在我想将其发送到我的电子邮件中,但是我遇到的麻烦是它显示中有一个字符串,$pdf但是在我的电子邮件中发送时为空。这是整个Codeigniter函数。

public function generatePDF()
{
    require_once(APPPATH.'third_party/dompdf/dompdf_config.inc.php');

    $dompdf = new Dompdf();
    $msg = $this->load->view('credit_agreement_view', '', true);
    $html = mb_convert_encoding($msg, 'HTML-ENTITIES', 'UTF-8');
    $dompdf->load_html($html);
    $paper_orientation = 'Potrait';
    $dompdf->set_paper($paper_orientation);

    // Render the HTML as PDF
    $dompdf->render();
    $pdf = $dompdf->output();

    // sending the pdf to email
    $this->load->library('email');
    $config['protocol'] = 'smtp';
    $config['smtp_host'] = 'ssl://smtp.gmail.com';
    $config['smtp_port']    = '465';
    $config['smtp_timeout'] = '7';
    $config['smtp_user']    = 'support@aurorax.co';
    $config['smtp_pass']    = '#######';
    $config['charset']    = 'utf-8';
    $config['newline']    = "\r\n";
    $config['mailtype'] = 'text'; // or html
    $config['validation'] = TRUE; // bool whether …
Run Code Online (Sandbox Code Playgroud)

php pdf codeigniter dompdf

5
推荐指数
1
解决办法
1903
查看次数

Laravel Dompdf 下载 pdf 的时间太长

我想在 Laravel 5.5 中使用 Dompdf 从 Blade 模板制作 pdf 发票。

问题是,当单击下载按钮时,页面正在加载,大约 3 分钟后,pdf 开始下载。

为什么要花这么长时间?

下载链接

<a href="{{ route('admin.download-invoice', $order->OrderID) }}" target="_blank" class="btn btn-danger"><i class="fa fa-file-pdf-o"></i> Download Invoice</a>
Run Code Online (Sandbox Code Playgroud)

网络路线:

Route::get('/order/download-invoice/{OrderID}', 'Admin\AdminOrderController@downloadOrderInvoice')->name('admin.download-invoice');
Run Code Online (Sandbox Code Playgroud)

一个简单的模板(invoice.blade.php)

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other 
head content must come *after* these tags -->
<title>Invoice</title>
<link rel="stylesheet" href="{{ asset('css/bootstrap.min.css') }}" media="screen">
</head>
<body>
   <div>{{ …
Run Code Online (Sandbox Code Playgroud)

dompdf laravel laravel-5 laravel-5.5

5
推荐指数
0
解决办法
7495
查看次数

Laravel 5:每页中的 DOMPDF(0.8.3) 页眉和页脚

我们使用的是 dompdf 版本 0.8.3。我们在报告中使用它,我们希望通过在每个页面的底部添加一些标题和页码来改进我们的报告。

目前,我们有页码,我们想要一些标题。

控制器

<!-- My other function/data -->
$pdf = PDF::loadView('purchase-order.export.export-pdf', $data)->setPaper('a4');
$pdf->getDomPDF()->set_option("enable_php", true);
return $pdf->stream('purchase-order-'.$purchase_order->number.'.pdf');
Run Code Online (Sandbox Code Playgroud)

PDF

@extends('layouts.formpdf')

@section('content')

<div id="page-wrap">
    <script type="text/php">
        if (isset($pdf)) {
            $x = 550;
            $y = 800;
            $text = "{PAGE_NUM}";
            $font = null;
            $size = 12;
            $color = array(255,0,0);
            $word_space = 0.0;  //  default
            $char_space = 0.0;  //  default
            $angle = 0.0;   //  default
            $pdf->page_text($x, $y, $text, $font, $size, $color, $word_space, $char_space, $angle);
        }
    </script>
.......
</div>
Run Code Online (Sandbox Code Playgroud)

问题:如何在每个页面中添加一些标题?

php dompdf export-to-pdf laravel

5
推荐指数
1
解决办法
8350
查看次数