openhtmltopdf
openhtmltopdf copied to clipboard
Table data out of page range
Hi,There is a question that i want to ask .Now,I shortly describe the scene:There is a table label on my html page ,and the table column is 9 .When column data is short, the pdf export the page looks ok.But When the data long than before,the data out of page. The question is how to controller the page width and the data looks normal on the pdf page.
Hi @xu-weize , could you provide a sample html page?
To be noted, you can also change the page size with: https://github.com/danfickle/openhtmltopdf/wiki/Page-features if your data don't fit your table .
@syjer I guess this issue is related to #578 .
Even the fix code suggested in #578 doesn't always work. If the table has very big number of columns, the getMaxWidth
method doesn't return the maximum box width in the page.
private float getMaxWidth(Box box) {
float maxWidth = 0;
maxWidth = Math.max(maxWidth, box.getWidth());
for (int i = 0; i < box.getChildren().size(); i++) {
maxWidth = Math.max(maxWidth, getMaxWidth(box.getChild(i)));
}
return maxWidth;
}
I guess there should be a way to auto fit/scale the content inside any page size.
Another related issue #189 .
Hi @abozanona,
Have you taken into account the page margins? Also, the cut-off page support outlined in the wiki may be an option. I'm going to start working on built-in scaling and auto-page enlargement solutions after the next release.
Are there any updates on this?