PHP code example of seguce92 / laravel-dompdf

1. Go to this page and download the library: Download seguce92/laravel-dompdf library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

seguce92 / laravel-dompdf example snippets


  $app->register(\Seguce92\DomPDF\ServiceProvider::class);
  

  $app->configure('dompdf');
  

    $pdf = App::make('dompdf.wrapper');
    $pdf->setWatermarkImage('path/to/image.png');
    $pdf->loadHTML('<h1>Test</h1>');
    return $pdf->stream();
    

    $pdf = App::make('dompdf.wrapper');
    $pdf->setWatermarkText('example', '150px');
    $pdf->loadHTML('<html><head><title>Hello world</title><body><h1>example</h1></body></html>');
    return $pdf->stream();
    

    $pdf->setWatermarkImage($image, $opacity = 0.6, $top = '30%', $width = '100%', $height = '100%');
    

    $image = path to image file *.png, *.jpeg, ect
    $opacity = values accept 1.0 - 0.11111
    $top = margin respect to top page
    $with = size image width
    $height = size image height

  - setWatermarkText

    

    $text = text a view with watermark
    $size = font size
    $opacity = values accept 1.0 - 0.11111
    $rotate = rotation text in deg values  (css transform-rotate
    $top = margin respect to top page