This is an internal documentation. There is a good chance you’re looking for something else. See Disclaimer.
Report-Engine¶
Starting with version 3.14 we use Gotenberg (https://gotenberg.dev) for report generation. Our Gotenberg docker images are hosted with VSHN and require basic auth credentials to access.
Credentials¶
Credentials to access these containers are stored in Bitwarden. Developers must configure these credentials for
local development using the application.properties
shown below.
Configuration¶
The following application.properties
are available to configure the Gotenberg pdf generation.
Name |
Default |
Description |
---|---|---|
nice2.conversion.pdf.gotenberg.url |
The url of the Gotenberg pod |
|
nice2.conversion.pdf.gotenberg.username |
The username used to access Gotenberg. See Bitwarden. |
|
nice2.conversion.pdf.gotenberg.password |
The password used to access Gotenberg. See Bitwarden. |
|
nice2.conversion.pdf.keepTemporaryFiles |
false |
A property that may be set if you want to keep temporary files. This is very useful for debugging purposes. |
Wait before rendering¶
When working with Gotenberg we need to make sure everything is properly rendered before the pdf is generated. To accomplish this, we tell Gotenberg to wait until the following javascript expression is true.
window.pagedjsAfterRendered === true
The code that sets this is in the boilerplate header. This header is automatically added to all reports as long as it does
not yet contain a <body>
tag. If you want to handle this manually, you could e.g. do it as follows
window.pagedjsAfterRendered = false
class AfterRenderedHandler extends Paged.Handler {
constructor(chunker, polisher, caller) {
super(chunker, polisher, caller);
}
afterRendered(pages) {
window.pagedjsAfterRendered = true
}
}
Warning
If the expression never successfully evaluates, report generation will run into a timeout! Make sure to
synchronize and reset everything. Especially all Output_template_layout
as headers and footers no longer are
separate html files.
Gotenberg Params¶
A documentation of all available Gotenberg params may be found in the official documentation
(https://gotenberg.dev/docs/routes). The used params are printed when using nice2.conversion.pdf.keepTemporaryFiles
.