fpdf-返回上一页 [英] fpdf - going back to the previous page

查看:57
本文介绍了fpdf-返回上一页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用fpdf生成pdf发票.

I am generating pdf invoice using fpdf.

一些包含许多项目的发票,详细信息需要进入第二页.但是,我需要在第一页上显示总计和其他详细信息.

Some invoices containing many items, and details need to go into the second page. However, I need the total, and other details to be displayed on the first page.

现在,如果我可以像这样添加新页面:$ pdf-> AddPage();

Right now, if I can add new page like this: $pdf->AddPage();

但是,这会将所有内容放入第二页,无论该语句之后是什么.

But, this puts everything into the second page, whatever after this statement.

似乎无法为write方法或cell方法指定页面.

There seems to be no way to specify the page for either write or cell methods.

渲染和计算有点复杂,因此不想存储到临时数组中并在完全渲染第一页后显示.

Rendering, and calculations are bit complex, thus don't want to store into a temp array and display after fully rendering the first page.

谢谢.

推荐答案

if(!empty($this->replace) && !empty($this->replacement)){
    $this->pages[$n]=str_replace($this->replace,$this->replacement,$this->pages[$n]);
}

我将此代码添加到_putpages()中的fpdf类中,位于/Page内容行2851的正下方

I added this code to the fpdf class in _putpages() right under /Page content line 2851

在上面添加代码后的示例:

Example after adding above to code:

$pdf->replace = array("{paid_msg}","{balance}");
$pdf->replacement = array("Paid","0.00");

它可以是字符串或数组.

It can be a string or an array.

这篇关于fpdf-返回上一页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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