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
set footer doesn't work #26
Comments
Hi, your code looks fine. I have tested this in my own tests by modifying test TestPDFGeneratorOutputFile to func TestPDFGeneratorOutputFile(t *testing.T) {
pdfg, err := NewPDFGenerator()
if err != nil {
t.Fatal(err)
}
htmlfile, err := os.Open("./testfiles/htmlsimple.html")
if err != nil {
t.Fatal(err)
}
defer htmlfile.Close()
pdfg.OutputFile = "./testfiles/TestPDFGeneratorOutputFile.pdf"
page := NewPageReader(htmlfile)
page.FooterRight.Set("[page]")
page.FooterFontSize.Set(10)
pdfg.AddPage(page)
err = pdfg.Create()
if err != nil {
t.Fatal(err)
}
pdfFile, err := os.Open("./testfiles/TestPDFGeneratorOutputFile.pdf")
if err != nil {
t.Fatal(err)
}
defer pdfFile.Close()
stat, err := pdfFile.Stat()
if err != nil {
t.Fatal(err)
}
if stat.Size() < 100 {
t.Errorf("generated PDF is size under 100 bytes")
}
} When opening this PDF, I see the page number in the footer (page 1). I have tested this on wkhtmltopdf versions 0.12.4 and 0.12.5. If everything else fails, try from a console to call wkhtmltopdf directly with parameters |
Sorry for the late update but it doesn't seems to work. Footer does not appear even with a simple : page := NewPage("https://www.google.com")
page.FooterRight.Set("[page]")
page.FooterFontSize.Set(10) |
I have the same issue with wkhtmltopdf 0.12.5 |
I have added this test which installs wkhtmltopdf 0.12.5 and then produces this PDF which prints the footer as expected. So any issue you are facing is most likely not in this package, but probably a wkhtmltopdf issue. @grmat Can you run the same test and post the output? |
Thanks for your response. I've just ran the test and this is the result: So yes, the problem seems to be unrelated to this project. It was the first place to look and had an issue open already. Sorry for the noise! |
Thanks for testing anyway, it is an interesting problem, best to report it at https://github.com/wkhtmltopdf/wkhtmltopdf and include your OS version. |
I have the same problem on Arch Linux with wkhtmltopdf 0.12.5. Did anyone create an upstream bug report? |
I tried running wkhmltopdf directly from the terminal with a footer option and got an error message After replacing the official Arch Linux wkhtmlpdftopdf package with wkhtmltopdf-static it works as it should. |
Good info, thanks a lot. Never used that version of wkhtmltopdf. |
Can't figure out what I'm missing to add footer in my page. Any clue ? The only page generated is OK but there is no footer at all
The text was updated successfully, but these errors were encountered: