The Magento core methods to generate PDF files are rather unflexible. An alternative are tools that convert HTML to PDF.
In our current Magento 2 project, which we (integer_net) develop together with Stämpfli AG, there is a requirement to dynamically create a PDF catalog based on selected products, which has almost the same layout as the product lists in the shop. So, generating this PDF based on HTML suggested itself.
In this article I present our solution, which integrates wkhtmltopdf
with the Magento layout. At the end you will find a link to the base module on Github.