【问题标题】:FPDF: Printing the text from another PHP echoFPDF:从另一个 PHP 回显中打印文本
【发布时间】:2012-08-10 19:20:56
【问题描述】:

我试图弄清楚如何在不创建物理 TXT 文件来打印数据的情况下打印出动态内容。

换句话说,我正在调用mytext.php 并写出内容...mytext.php 看起来像这样:

<?php echo "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";

PDF 是由文本中的所有内容生成的......所以&lt;?php echo "Lorem..."

打印动态内容的最佳方式是什么?

【问题讨论】:

    标签: pdf-generation fpdf


    【解决方案1】:

    我通常做的是从生成 pdf 的脚本中组装动态内容(查询 db,使用后变量...)。

    如果这不是必需的并且您调用的 php 脚本输出纯文本,您可以使用输出缓冲。

    这里已经提出了一个问题的答案: Read echo'ed output from another php file.

    所以基本上,您将输出放在一个变量中,然后使用 FPDF 写入、单元格或多单元格函数,将其放在您的 pdf 中。

    【讨论】:

    • 是的,我认为这也是要走的路!谢谢!
    猜你喜欢
    • 2012-12-16
    • 1970-01-01
    • 1970-01-01
    • 2012-09-13
    • 2013-12-22
    • 2023-03-12
    • 2014-08-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多