spatie / laravel-pdf

Create PDF files in Laravel apps
https://spatie.be/docs/laravel-pdf
MIT License
715 stars 54 forks source link

add set header and footer section #20

Closed ArielMejiaDev closed 10 months ago

ArielMejiaDev commented 10 months ago

It adds a section for set header and footer that is blank here

It explains how to set both and adds a pretty basic, but useful example of a footer that anyone can just copy and paste in their own projects relatively easily.

The explanation is based on this Browsershot section

freekmurze commented 10 months ago

Thanks, I think I can explain this simpler, I'll add it myself! 👍

ArielMejiaDev commented 10 months ago

Thanks, what I try to communicate is that, when I installed the package and copy & paste the code from the docs, it looks like it does not show any footer or header because it requires it's own styles and font-size is needed to be able to see the text in both cases.

Another thing that I try to communicate it that puppeteer render html in different processes so the classes from for pdf content view, does not apply in header and footer.

by the way taking in mind how puppeteer works the blade directives inside PDF content view does not work, it only works in a separate blade view for header or footer, or using inline html with headerHtml() or footerHtml().

My goal was to add an example that feels like a quick and good developer experience as Spatie always does in their packages.

I can add a Discussion topic about this as a guide for the cases when someone expects other behavior from puppeteer, if that is fine for you.