phpc.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
A server for PHP programmers & friends. Join us for discussions on the PHP programming language, frameworks, packages, tools, open source, tech, life, and more.

Administered by:

Server stats:

840
active users

🧵Currently optimizing the PDFs of
6. Our customer Kinowerbung.de has lot's of line items with sub-items. Interestingly 's default behaviour of automatic page breaks in tables with repeating table headings is not used 🤔
@ShopwareDevs

To encounter memory issues we already removed the repeating logo earlier on. We now optimized the structure, removed the repeating letter head and some other elements our customer did not want on every page.

Daniel Gehn

But this does not remove the superfluous whitespace.

Because Shopware uses it's own logic to create page breaks, the number of line items is the same for every page. But we now have more space on all pages after the first one. The way the templates and blocks are built prevents us to customize this calculation.

So we tried using a very high line item count per page to trigger the automatic page break in the table.

To repeat some parts which should appear on every page, we moved them to the table head and applied the needed styling. So this is our currently final result.

As you can see, the document pages look way cleaner, can fit more content and it's still obvious which offer a page belongs to. If there's enough interest in details how this can be achieved, I may write a blogpost about it.

✍️ Blogpost is in the works and will hopefully be done soon. 👀

@theiNaD Is this a good candidate for a PR, maybe? I prefer sane defaults (e.g. table page breaks) that I can customize if needed, instead of the other way around 🙂 Nice work!

@kleinmann this solution currently has some drawbacks regarding the table summary and postface information at the end, as they won't have the page header (because they don't have this `thead`) even if they are on a new page. We needed a quick solution, maybe it could be a "new" type of rendering behind a feature flag?

@theiNaD Not sure if I can distinguish the parts that move towards the default behavior of dompdf versus the stuff specific to your customer. Most invoices I receive usually (at least I think) omit the header on all further pages as well 🤔 #shopware may see it as a compatibility break either way, so there’s that challenge as well 😅