I’m trying to convert a html page containing a single table (whose td
s contain either images or text) to a pdf. I am using weasyprint
as a python module.
My problem is that weasyprint inserts page breaks in the middle of columns, which I do not want.
What I would like to do is either:
- Rescale (downscale) the page to fit into the height of a page
- Change the page height to fit the height of the content
The size of the table (amount of rows / columns) is variable (I don’t know it in advance).
Things I tried:
1.
I tried using the css page.size property to change the page size, but it doesn’t work because I don’t know the size of the table in advance.
2.
I tried adding the following
body html{
height: 100%;
}
and adding a lot of display:block
, but those simply make scrollbars appear, it doesn’t resize the content to fit.
3.
I tried restricting page breaks using
table {
break-inside: avoid;
}
but it didn’t change anything
from weasyprint single page html
No comments:
Post a Comment