mPDF watermark question

Hello yii. I use mpdf ( http://www.yiiframework.com/extension/yii2-mpdf/ ) to generate a pdf with some informations. I tried to add a watermark, but idk any idea how to do this. I found some posts on forum, but nothing, I started with demo:


    $pdf = new Pdf([

        // set to use core fonts only

        'mode' => Pdf::MODE_CORE, 

        // A4 paper format

        'format' => Pdf::FORMAT_A4, 

        // portrait orientation

        'orientation' => Pdf::ORIENT_PORTRAIT, 

        // stream to browser inline

        'destination' => Pdf::DEST_BROWSER, 

        // your html content input

        'content' => $content,  

        // format content from your own css file if needed or use the

        // enhanced bootstrap css built by Krajee for mPDF formatting 

        'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css',

        // any css to be embedded if required

        'cssInline' => '.kv-heading-1{font-size:18px}', 

         // set mPDF properties on the fly

        'options' => ['title' => 'Krajee Report Title'],

         // call mPDF methods on the fly

        'methods' => [ 

            'SetHeader'=>['Krajee Report Header'], 

            'SetFooter'=>['{PAGENO}'],

        ]

    ]);




Sombady, any idea? Thx :D

You can use the watermark-methods of mPdf, to be found in the mPdf documentation. Unfortunately, this is my first post and therefor I cannot provide a link, but you can find the info on mpdf.github.io in the "What else can I do" section.


    $pdf = new Pdf([


        // skipping other code


        'methods' => [ 

            'SetHeader'=>['Krajee Report Header'], 

            'SetFooter'=>['{PAGENO}'],

            'SetWatermarkText'=>'DRAFT',

        ]

    ]);




hey, thx for answare! I tried this but nothing happened… the text does not appear