簡體   English   中英

如何使用FPDI / FPDF從PDF中刪除文本

[英]How to delete text from PDF using FPDI/ FPDF

我想使用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頁面的文本。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM