Closed Jahija303 closed 9 months ago
Update: the solution is pretty simple, I used camel case instead of snake case for the pdf configuration object. Making this small change fixes the issue for me.
page.pdf(
{
path: File.join(__dir__, "pdf", "output.pdf"),
landscape: false,
format: "A4",
margin: {top: "3cm", right: "2cm", bottom: "3cm", left: "2cm"},
display_header_footer: true,
header_template: "<span style=\"font-size:10px;color:#000000;line-height:1.3;margin:0;\">Custom Header</span>",
footer_template: "<span style=\"font-size:10px;color:#000000;line-height:1.3;margin:0;\">Custom Footer</span>"
}
)
I am having issues setting custom header/footer using puppeteer-ruby. They do not display on the exported pdf file. I managed to do this in nodejs with puppeteer without any major issues. However, using the same configuration here does not seem to work.
Step To Reproduce / Observed behavior
Expected behavior
Exported pdf should display header and footer
Environment
Ubuntu 23.04 Chrome 117.0.5938.149-1 ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]