php - 如何使用 FDI/FPDF 从 PDF 中删除文本

我想使用 FPDI/FPDF 在 php 中编辑 PDF。我想替换特定的文本。我尝试了很多解决方案,但他们没有给出预期的结果。所有人都在新位置写一些新文本。我想搜索一些文本并用新文本替换该文本。
这可能吗?如果是,请解释。
代码:

    require_once('fpdf.php');
    require_once('fpdi.php');

    $pdf =& new FPDI();
    $pdf->AddPage();


    //Set the source PDF file
    $pagecount = $pdf->setSourceFile("test.pdf");

    //Import the first page of the file
    $tpl = $pdf->importPage(1);
    //Use this page as template
    $pdf->useTemplate($tpl);



    //Go vertical position
    $pdf->SetY(15);
    //Select Arial italic 8
    $pdf->SetFont('Arial','I',8);
    //Print centered cell with a text in it
    $pdf->Cell(0, 10, "Hello World", 0, 0, 'C');

     //want something like this
     $pdf->replace("old_text","new_text");    

     $pdf->Output("my_modified_pdf.pdf", "F");

最佳答案

无法使用 FPDI 编辑 PDF 文档,也无法使用 FPDI 替换导入的 PDF 页面的文本。

https://stackoverflow.com/questions/33037429/

相关文章:

time - NetLogo 时间扩展 : Plotting graphs does not wor

numpy - numpy 中有 elliptictheta 函数吗?

cmake - 如何编写功能测试脚本在cmake/ctest下运行

session - 身份验证为匿名的用户已尝试访问拥有的 session

wpf - 更改 UIElement 的角度

elixir - 左外连接与 Elixir 的理解

c# - 如何知道壁虎浏览器是否完成加载网页?

c++11 - 将 char16_t 转换为 long/integer,(相当于 atoi/atol

cross-compiling - Clang++ 无法找到任何 stdlib header

codeigniter - 从数据库下载文件或在 codeigniter 中保存文件夹