CodeIgniter Forums
Watemark on PDF - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Watemark on PDF (/showthread.php?tid=87184)



Watemark on PDF - SubrataJ - 03-23-2023

Is there any library to add a watermark on the existing pdf?


RE: Watemark on PDF - abatrans - 03-23-2023

Have a look at Mpdf, it might solve your issue.


RE: Watemark on PDF - InsiteFX - 03-23-2023

Use mPDF.

mPDF -> SetWatermarkImage()


RE: Watemark on PDF - SubrataJ - 03-24-2023

Thank you , the thing is now I am able to add watermark on existing pdf using below code 
PHP Code:
$path 'dynamics/flight-plan.pdf';
        $mpdf = new Mpdf();
        $mpdf->SetDisplayMode('fullpage');
        $pagecount $mpdf->setSourceFile($path);
        for ($i 1$i <= $pagecount$i++) {
            $tplId $mpdf->importPage($i);
            $mpdf->UseTemplate($tplId);
            $mpdf->SetWatermarkText('CONFIDENTIAL');
            $mpdf->showWatermarkText true;
            $mpdf->AddPage();
        }
        $mpdf->Output('filename.pdf', \Mpdf\Output\Destination::FILE); 


but sometimes I get this error "This PDF document probably uses a compression technique which is not supported by the free parser shipped with FPDI."


RE: Watemark on PDF - JustJohnQ - 03-24-2023

https://www.setasign.com/support/faq/fpdi/error-document-compression-technique-not-supported/


RE: Watemark on PDF - SubrataJ - 03-24-2023

(03-24-2023, 07:20 AM)JustJohnQ Wrote: https://www.setasign.com/support/faq/fpdi/error-document-compression-technique-not-supported/

yeah thanks, I had to buy their commercial addon. anyway, I am gonna mark this one as solved now.