Currently, I am utilizing spatie/browsershot to generate PDF documents within a Laravel project. While it offers convenient methods such as headerHtml and footerHtml for customization, there seems to be an issue with handling images. Specifically, only base64/svg images are accepted, resulting in some images with transparent backgrounds being cut off during printing.
To work around this limitation, I have opted to use CSS to incorporate my header and footer designs. However, a new challenge arises when applying @page margin, causing the header and footer elements to shift due to the imposed margins. This can be observed in the following illustration: https://i.stack.imgur.com/hxTMU.png
It's worth noting that I need to include @page margin on every page instead of setting margin-top/bottom directly on headers (h1-h6) due to the dynamic nature of the content where a pagebreak might occur unpredictably.
In the absence of @page margin, the header and footer alignment remains intact, but the content loses its intended margin layout, leading to content overlapping with the header section, illustrated here: https://i.stack.imgur.com/7qW8h.png
Please see below the code snippet from the index blade file:
<!DOCTYPE html>
<html lang="en">
<!-- The rest of your HTML code comes here -->
If you encounter any issues or have suggestions for resolving this matter, kindly provide your feedback. Thank you for your assistance.