PHP 7 HTML2PDF.js Script to Add Background Watermark Text and Image to PDF Document Page in Browser Using HTML5 & Javascript

You are currently viewing PHP 7 HTML2PDF.js Script to Add Background Watermark Text and Image to PDF Document Page in Browser Using HTML5 & Javascript

PHP 7 HTML2PDF.js Script to Add Background Watermark Text and Image to PDF Document Page in Browser Using HTML5 & Javascript

<span class="pl-kos"><</span><span class="pl-ent">page</span><span class="pl-kos">></span>
    <span class="pl-kos"><</span><span class="pl-ent">page</span><span class="pl-c1">_header</span><span class="pl-kos">></span>
       ...              
    <span class="pl-kos"></</span><span class="pl-ent">page</span>_header<span class="pl-kos">></span>
    <span class="pl-kos"><</span><span class="pl-ent">page</span><span class="pl-c1">_footer</span><span class="pl-kos">></span>
       ...
    <span class="pl-kos"></</span><span class="pl-ent">page</span>_footer<span class="pl-kos">></span>
    ...
<span class="pl-kos"></</span><span class="pl-ent">page</span><span class="pl-kos">></span>

<span class="pl-kos"><</span><span class="pl-ent">page</span> <span class="pl-c1">backtop</span>="<span class="pl-s">7mm</span>" <span class="pl-c1">backbottom</span>="<span class="pl-s">7mm</span>" <span class="pl-c1">backleft</span>="<span class="pl-s">10mm</span>" <span class="pl-c1">backright</span>="<span class="pl-s">10mm</span>"<span class="pl-kos">></span>
    <span class="pl-kos"><</span><span class="pl-ent">page</span><span class="pl-c1">_header</span><span class="pl-kos">></span>
         Page Header
    <span class="pl-kos"></</span><span class="pl-ent">page</span>_header<span class="pl-kos">></span>
    <span class="pl-kos"><</span><span class="pl-ent">page</span><span class="pl-c1">_footer</span><span class="pl-kos">></span>
         Page Footer
    <span class="pl-kos"></</span><span class="pl-ent">page</span>_footer<span class="pl-kos">></span>
 
    Page Content
<span class="pl-kos"></</span><span class="pl-ent">page</span><span class="pl-kos">></span>

<span class="pl-s1"><span class="pl-c1">
lt;/span>pdf</span> = <span class="pl-k">new</span> \<span class="pl-v">Spipu</span>\<span class="pl-v">Html2Pdf</span>\<span class="pl-v">Html2Pdf</span>(<span class="pl-s">'P'</span>,<span class="pl-s">'A4'</span>,<span class="pl-s">'en'</span>, <span class="pl-c1">false</span>, <span class="pl-s">'UTF-8'</span>, <span class="pl-en">array</span>(mL, mT, mR, mB));
<span class="pl-s1"><span class="pl-c1">
lt;/span>pdf</span>-><span class="pl-en">writeHTML</span>(<span class="pl-s1"><span class="pl-c1">
lt;/span>htmlContent</span>);
<span class="pl-s1"><span class="pl-c1">
lt;/span>pdf</span>-><span class="pl-en">Output</span>();

Ranjith

Hi, I'm Manoj a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply