That's Javascript? Nothing to do with laravel. There are several laravel pdf packages if you want to do it there.
But I guess it takes html + css and generate the pdf. So why don't you try setting a background image on the body
How to add an 'image watermark 'or image background in a PDF file in Laravel? Using this function: $(document).ready(function($) { $(document).on('click', '#generatePDF', function(event) { let invoice_number = $("#invoice_number").text() event.preventDefault(); var element = document.getElementById('print-invoice'); var opt = { margin: [0, 0, 30, 0], filename: 'Invoice_'+ invoice_number +'.pdf', image: { type: 'jpeg', quality: 0.98 }, backgroundimage:{url('images/lh.jpg')}, //THIS ONE IS NOT WORKING. html2canvas: { dpi: 192, scale: 5, letterRendering: true}, jsPDF: { unit: 'pt', format: 'a4', orientation: 'portrait'}, pageBreak: { mode: 'css', after:'.break-page'} }; html2pdf().set(opt).from(element).save(); }); });
Please help. I am not good at all in Laravel.
Thanks
Please or to participate in this conversation.