相关疑难解决方法(0)

FPDI/FPDF:水印和打印多页

我修改了这个堆栈问题:当用户尝试下载文件时在pdf文件上应用水印但是我遇到了一个错误,虽然有一条评论说明如何解决它,但它还不够详细.

这是代码:

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

class WaterMark

{
    public $pdf, $file, $newFile,
        $wmText = "STACKOVERFLOW";

/** $file and $newFile have to include the full path. */
public function __construct($file, $newFile)
{
    $this->pdf = new FPDI();
    $this->file = $file;
    $this->newFile = $newFile;
}

/** $file and $newFile have to include the full path. */
public static function applyAndSpit($file, $newFile)
{
    $wm = new WaterMark($file, $newFile);

    if($wm->isWaterMarked())
        return $wm->spitWaterMarked();
    else{
        $wm->doWaterMark();
        return $wm->spitWaterMarked();
    }
}

/** @todo Make the text nicer …
Run Code Online (Sandbox Code Playgroud)

php fpdf fpdi

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

fpdf ×1

fpdi ×1

php ×1