10

I'm trying to generate a print-ready HTML file and therefore started working with CSS @page and everything around it. One big problem I'm facing is that I can't manage to display page numbers using @bottom-right and all similar solutions. Do you know if there could be a general reason behind it (like it's deprecated, etc.), as I've tested even the simplest solutions like:

@page {
  @bottom-right {
    content: counter(page);
  }
}

and still nothing seems to make the pagination or any other content appear.

Towkir
  • 3,889
  • 2
  • 22
  • 41
Dani Dimitrov
  • 101
  • 1
  • 3
  • Did you put this into `@media print { .. }`? – Johannes Feb 09 '18 at 17:07
  • Yep, forgot to mention, tried both with media print and media all :/ – Dani Dimitrov Feb 09 '18 at 17:10
  • Ehm, CanIUse doesn't even list `@bottom-right`, so I'm not sure if many browsers support it yet. – Mr Lister Feb 10 '18 at 08:36
  • Not sure if this helps, but it sounds similar: [https://stackoverflow.com/questions/20050939/print-page-numbers-on-pages-when-printing-html](https://stackoverflow.com/questions/20050939/print-page-numbers-on-pages-when-printing-html) – LVdH Jan 21 '19 at 10:47
  • 1
    I had a similar issue and I found this article illuminating: https://www.smashingmagazine.com/2015/01/designing-for-print-with-css/ – Adriano May 07 '19 at 01:24

1 Answers1

2

What are you using to render this? A lot of browsers don't have proper support for print CSS, so it might be better to use something specifically built for it, like weasyprint.

Moira Jones
  • 369
  • 1
  • 7