laravel-dompdf print with text watermark in every page
I stuck with a problem that is print watermark text to every page. after searching various areas of internet i found a working solution to my problem. i'm now shearing it. so it will useful to someone who have same problem
first you have to install laravel-dompdf wrapper.
then need to add 'PDF' word to app config aliases list(rootfolder/config/app.php)
import pdf class to controller(or any kind of class object)
create pdf wrapper object by loading blade file to laravel-dompdf
set paper size (i set L means 'letter size')
then need to render it(we can't call dompdf render function directly. we can use output function for that comes with laravel-dompdf
now this need to get core dompdf object from laravel-dompdf wrapper to get canvas(canvas need to add watermark). here how it do
getting canvas height and width. this is optional.
so i need to place every page this watermark opacity(transparency) for that i used like this .'Multiply' means add it to every page.
if you want set opacity to one page just use as
now need to place text to every page.
function parameter names:
page_text(x axis value, y axis value, 'your text, font(or null), font size,rgb color array, word space, char space, angle(- or +));
to prview it on browser we can use as usual
or download on visit to link
here final code example
thats all..
Comments
Post a Comment