Improvement: Gotenberg PDF generation (modern css/js) #1134
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Love the blade templates. I am also a big fan of tailwind. Unfortunately DomPDF does not support modern css/js, so I opted to implement an external PDF service called gotenberg which can render html in a headless browser and print it as PDF. This enabled the most-up-to-date features.
With this PR, templates can use modern JS / CSS.
For example. My estimate template uses flexbox and grid and uses the Tailwindcss CDN library to "build" the stylesheet when the page loads, like this:
The current PR is just to check if there would be any interest in this. It is not suitable for merging, but it is functional.
To get this mergeable, I'd implement an interface or adapter for PDF generation and allow the user to select which kind of generation they want: DomPDF or Gotenberg. Furthermore when Gotenberg is selected, they are required to enter some settings like service url.
Please excuse my PHP, I haven't written any in the last 8 years.