Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Rameshwar-ghodke/a578f3dddfb43dbbaa4b77d7af710cfb to your computer and use it in GitHub Desktop.
Save Rameshwar-ghodke/a578f3dddfb43dbbaa4b77d7af710cfb to your computer and use it in GitHub Desktop.
1)Add Watermark to print page using HTML CSS 2) also using mpdf function into PHP controller at time of generate pdf add watermark
// USING HTML & CSS
<div class="watermark"> Watermark text ा</div>
.watermark {display: inline; position: fixed !important; opacity: 0.25; font-size: 3em; width: 100%; text-align: center; z-index: 1000; top: 50%; right: 5px; writing-mode: horizontal-tb; }
// USING PHP and MPDF()
$mpdf = new mPDF('utf-8', 'A4-C');
$mpdf->showWatermarkImage = true;
// $mpdf->showWatermarkText = true;
// $mpdf->WriteHTML('<watermarktext content="watermark text alpha="0.3" />');
$mpdf->SetWatermarkImage(
imagepath, // image src path
0.10, // set opacity
array(90,120) // set image into page position
);
$mpdf->WriteHTML($html);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment