Is there a way to vertically center a container if it's bumped to a new page when printed out?
As the diagram shows, container A may grow too big that A and B will occupy their own pages. When that happens I want B or both to be centered.
+----------------+ +----------------+ +----------------+
| +------------+ | | | | |
| | | | | +------------+ | | |
| | A | | | | | | | |
| | | | | | | | | +------------+ |
| +------------+ | | | | | | | | |
| | +---> | | A | | | | B | |
| +------------+ | | | | | | | | |
| | | | | | | | | +------------+ |
| | B | | | | | | | |
| | | | | +------------+ | | |
| +------------+ | | | | |
+----------------+ +----------------+ +----------------+
We are using wkhtmltopdf to generate the PDFs. In our case printing from the PDF is enough. But as far as I know wkhtmltopdf doesn't support centering like this. So I'm wondering if this can be achieved via css and/or javascript.
One idea is calculating the container's height and set the appropriate top margin in JS. But this requires the knowledge of when/if the container is moved to the next page, I assume?