docs: document Gotenberg PDF generation - #20
Merged
Conversation
The site had no Gotenberg coverage at all, despite it being a supported PDF driver — so the only way to learn the setup was to read config/pdf.php. Covers when to switch from dompdf (mixed-script documents, modern CSS in custom templates), a compose example, the settings and their defaults, and troubleshooting for the errors people actually hit. Most of the page is the private-network section. Gotenberg normally runs as a sidecar, InvoiceShelf blocks private hosts because it returns the upstream response as the PDF, and GOTENBERG_ALLOWED_PRIVATE_HOST names one host rather than switching the guard off. That trips people up on first setup and the reasoning is not obvious from the error message.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Changes
The site had no Gotenberg coverage at all —
grep -ri gotenbergacross the repo returned nothing — despite it being a supported PDF driver. The only way to learn the setup was to readconfig/pdf.phpin the app.Adds
guide/pdf-generation.mdand a sidebar entry next to Custom Templates.The page covers:
On the private-network section
This is the part worth reviewing. Gotenberg normally runs as a sidecar on a private network, which InvoiceShelf blocks by default, so the standard setup hits a wall on first save with a message that explains the rule but not the remedy.
The page explains why the guard exists — InvoiceShelf returns the upstream response body to the browser as the PDF, so an unrestricted host is a way to read internal services — and then why
GOTENBERG_ALLOWED_PRIVATE_HOSTnames a single host instead of being an on/off switch, and why it is environment-only rather than a toggle in the admin UI. That reasoning isn't discoverable from the error message and is the thing people will search for.It also documents the behaviour that a hostname which does not resolve saves cleanly and only fails at render time, since that turns a typo into a confusing delayed failure.
Test plan
yarn buildpasses;guide/pdf-generation.htmlis emitted./guide/custom-templates.md) resolves — VitePress fails the build on dead links, so the passing build covers this too.Notes
Written against the behaviour in InvoiceShelf
3.xas of InvoiceShelf/InvoiceShelf#691 and #699, which introducedGOTENBERG_ALLOWED_PRIVATE_HOSTand made the dev compose stacks configure it automatically.