You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for a use case of generating A4 from HTML pages (for email attachments), I have noticed while switching from KnpSnappyBundle to WeasyPrintBundle, the output font text ends up much bigger, while keeping an overall layout coherence:
WeasyPrint does not provide support for adjusting page size or document margins via command-line flags. This is best accomplished with the CSS @page at-rule
As you already found out adding @page CSS rule is the only option available.
For orientation option you can add it after size:
@page {
size: A4 landscape;
}
For dpi option you can experiment with image-resolution (I've never tried it):
img { image-resolution:300dpi }
I suggest to prepare a dedicated twig template and css for pdf generation, and don't recycle twig/html created for browser use.
Hello,
for a use case of generating A4 from HTML pages (for email attachments), I have noticed while switching from KnpSnappyBundle to WeasyPrintBundle, the output font text ends up much bigger, while keeping an overall layout coherence:
KnpSnappyBundle:
WeasyPrintBundle:
with the following added to the source HTML
<style>
tag to "enforce" A4 page sizeWould you have CSS/display/options tips for migrating?
The text was updated successfully, but these errors were encountered: