dimanche 19 janvier 2020

Background image in PDF file

I am beginner in Laravel and php. I use in my project Laravel 5.8.

I generate PDF by barryvdh/laravel-dompdf. I have this code:

$logo = public_path('assets/images/logo_print.jpg');
        $pdf = \PDF::loadView('psCMS.prints.raport1', ['nutritionPlan' => $nutritionPlan, 'logo' => $logo, 'nutrition'=> $Nutrition, 'numberOfPeople'=>$numberOfPeople, 'foodDemand'=>$foodDemand, 'weightedAverage' => $weightedAverage, 'dailyRequirementFacility'=>$dailyRequirementFacility, 'protein' => $protein , 'fat'=>$fat , 'carbohydrates'=>$carbohydrates,  'roughage'=>$roughage ]);
        $pdf->setOptions(['isPhpEnabled' => true, 'dpi' => 150, 'setIsRemoteEnabled' => true]);
        $pdf->setPaper('A4', 'landscape'); // letter
        return $pdf->download('Raport' . '-' . now()->toDateString() . '.pdf');

This is working nice. I need add to my pdf file background image (watermark). I prepare jpg file. How can I add this image to background PDF?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/38hKw1Z
via IFTTT

Aucun commentaire:

Enregistrer un commentaire