Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement: Gotenberg PDF generation (modern css/js) #1134

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

TimVosch
Copy link

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:

<html>
<head>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body>
   <div class="p-4 bg-cyan-500 font-bold text-white">Hello!</div>
</body>
</html>

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant