-
Notifications
You must be signed in to change notification settings - Fork 9
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
Enabling printBackground
for html to PDF conversion?
#33
Comments
This is how to do it:
however, the typings are not updated for this yet.
|
Hello! Gotenberg:7 was released 5 days ago, and this library is not yet compatible with it. There is an issue for that. It is possible to manually adjust request, as you already figured that out :) This doesn't looks good, though, I know... const toPDF = pipe(
gotenberg(''),
convert, // it is save to remove this line, if you want
html,
adjust({
// manually adjust endpoint, because
// gotenberg:7 has different conversion endpoints
url: 'http://localhost:3500/forms/chromium/convert/html',
// manually adjust for fields
fields: {
printBackground: true,
// `printBackground` is not valid field for gotenberg:6
// so we have to cast to any, otherwise typescript will complain
} as any,
}),
please
) I've tested, and this works fine. |
Oh, you don't have to adjust URL if you add pipe(
// / gotenberg url:port \
gotenberg('http://localhost:3500/forms/chromium'),
convert,
html,
adjust({
fields: {
printBackground: true,
} as any,
}),
please
) |
Thanks @yumauri! This library is really good - thank you. |
I would like to enable the
printBackground
option when creating a PDF with HTML. In Gotenberg's documentation, we can pass a param in the form data to enable this: https://gotenberg.dev/docs/modules/chromiumHow can i do the same with
gotenberg-js-client
?The text was updated successfully, but these errors were encountered: