We have found a problem in the current develop branch of ERPNext.
The problem was that when you generate a PDF from a print format the CSS styles were not applied when bench is running on supervisor and nginx. The styles are applied to the preview but the generated PDF is broken. This has to do with the PDF generator library wkhtmltopdf.
It was a bit harder to debug because when you run bench in developer mode with
bench start or if you don’t have https configured (letsencrypt) this problem doesn’t happen. Thanks to the developer chat on telegram we were able to find the solution.
Before updating to the latest develop you have to update your wkhtmltopdf version to 0.12.5. Most of you probably have 0.12.3 or 0.12.4 installed.