- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我希望能够使用 PHP 在现有的 pdf 文档上写入/覆盖文本。我希望做的是拥有一个可以充当模板的 pdf 文档,并通过打开模板文档、覆盖相关文本并将结果作为新文档来填补空白。模板文档是单个页面,因此不需要页面合并/操作。
有没有免费的图书馆可以做到这一点?我应该看哪里?我所做的大多数搜索似乎都涉及合并文档/添加页面,而不是将内容覆盖在现有页面上。
谢谢。
*编辑:这是我所做的:1.下载FPDF2.从
下载FPDI + FPDF_TPLhttp://www.setasign.de/products/pdf-php-solutions/fpdi/downloads/
以下是一些供 future 流浪者使用的示例代码(改编自 www.setasign.de 上的示例):
<?php
include('fpdf.php');
include('fpdi.php');
// initiate FPDI
$pdf =& new FPDI();
// add a page
$pdf->AddPage();
// set the sourcefile
$pdf->setSourceFile('templatedoc.pdf');
// import page 1
$tplIdx = $pdf->importPage(1);
// use the imported page as the template
$pdf->useTemplate($tplIdx, 0, 0);
// now write some text above the imported page
$pdf->SetFont('Arial');
$pdf->SetTextColor(255,0,0);
$pdf->SetXY(25, 25);
$pdf->Write(0, "This is just a simple text");
$pdf->Output('newpdf.pdf', 'D');
?>
最佳答案
看看FPDI Library添加到 FPDF用于模板注释。
它也可以固定到 TCPDF ,另一个流行的 PHP PDF 库。现有的 PDF 被用作页面的基础,而不是空白,之后的过程与常规 PDF 创建相同。
关于php - 用 PHP 在 PDF 模板文档上书写/绘图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4299315/
我正在开发 GPA 计算器,而且我是 C 语言新手。我在 Ubuntu 12 中使用 gvim 编写此代码,并在终端中使用 gcc 进行编译。 这是我到目前为止的代码。我还想包含一种检查方法,以确保用
我正在使用tinymce 编辑网络应用程序中的某些字段。我需要一个带有一些规范的 html 结果(编辑后)。 例如:当我按 Entertinymce 时,创建一个新段落(没关系,我知道可以更改此行为,
我正在尝试在EmguCV(OpenCV C#包装器)图像上绘制多于一行的字符串。但它表明EmguCV无法识别新行“\ r \ n”字符。 如何实现呢?另外,如何获取文本高度,以便可以手动设置下一个字符
我有一个 richTextBox,一个人将在其中阅读患者的医疗记录。 我添加了一个按钮,用于将今天的日期(以 DD/MM/YYYY 格式)添加到 richTextBox 中。当有人需要更新病人的记录时
我是一名优秀的程序员,十分优秀!