【问题标题】:PHP: reading a PDF and obtaining the position of a specific word (tag)PHP:读取 PDF 并获取特定单词(标签)的位置
【发布时间】:2019-11-30 12:01:57
【问题描述】:

我有一个 Laravel 5.6.39 项目,其中包含使用这些包的有效签名解决方案:

*"codedge/laravel-fpdf": "^1.3",

"setasign/fpdi": "^2.2",

"setasign/fpdi-fpdf": "^2.2"*

但这仅适用于最后一页的固定位置,右下角。我需要实现的是:

  • 阅读 PDF
  • 找一个词(如签名等)
  • 获取该单词的坐标
  • 在已经准备好的图像插入函数中使用这些坐标。

    // use the imported page and adjust the page size
    $pdf->useTemplate($templateId, ['adjustPageSize' => true]);
    if ( $pageNo == $pageCount ) {
        $fullname = iconv('UTF-8','ISO-8859-2',$client->name).' '.iconv('UTF-8','ISO-8859-2',$client->lastname);
        $pdf->Image(public_path('storage/signatures/resized/'.$signature->signature_image), 115, 255, 50, '', '', '', '', false, 400);
        $pdf->AddFont('Arial','','arial.php');
        $pdf->SetFont('Arial');
        $pdf->SetXY(115, 263); //fixed coordinates, I need X,Y for word tag
        $pdf->Write(10, $fullname.' '.date('d.m.Y'));
    }
    

有没有人做过类似的事情并可以提供一些建议?

我正在阅读 SetaPDF-Extractor (https://www.setasign.com/products/setapdf-extractor/details/),它可能是我需要的东西,但我需要在购买之前确定这一点。

【问题讨论】:

  • 因此,请在购买之前请求 SetaPDF-Extractor 组件here 的评估版。 FPDF/FPDI 无法完成您的任务。

标签: php laravel image pdf fpdf


【解决方案1】:

使用 SetaPDF-Extractor 做得很好。试了评测,买了license,一个小时就收到了不错的效果。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-07-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多