如何使用dompdf在laravel 4.2中添加自定义动态文本页脚 [英] how to add custom dynamic text footer in laravel 4.2 using dompdf

查看:104
本文介绍了如何使用dompdf在laravel 4.2中添加自定义动态文本页脚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了以下示例 laravel- 4-create-pdf-use-dompdf :

如何添加自定义动态页脚

how to add custom dynamic footer

 $dompdf = \App::make('dompdf');
 $dompdf->loadHTML('<h1>naeem World!!</h1>');

有人有主意吗?或请提出建议,

anyone do have idea? or please suggest,

我也遵循了此解决方案 DOMPDF添加页眉和页脚,但是不能正常工作.

i also have followed this solution DOMPDF add a header and footer but it doesn't work correctly.

我希望$db_data['footer_text']动态地成为所有页面的页脚文本,它是表单数据库.

i want $db_data['footer_text'] to be footer text to all the pages dynamically, its coming form database.

推荐答案

您提供的链接中的解决方案就足够了.您只需要制作一个更完整的HTML文档即可.

The solution from the link you provided should be enough. You just need to craft a more complete HTML document.

$html = <<<EOT
  <html>
  <head>
    <style>
      @page { margin-bottom: 50px; }
      .footer { position: fixed; bottom: -50px; margin: 10px; }
    </style>
  </head>
  <body>
    <h1>naeem World!!</h1>
    <h2>section 1</h2>
    <div style="page-break-before: always;"></div>
    <div class="footer">{$db_data['footer_text']}</div>
    <h2>section 2</h2>
  </body>
  </html>
EOT;
$dompdf = \App::make('dompdf');
$dompdf->loadHTML($html);

这篇关于如何使用dompdf在laravel 4.2中添加自定义动态文本页脚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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