danfickle / danfickle/openhtmltopdf

How to get the resulting height of the rendered html?

Open
#427 12 comments 0 reactions 1 assignee Claimed by @danfickle View on GitHub
Dominant language
Java
Stars
2.2k
Forks
423
PR merge metrics
No merged PRs in 30d

Description

Hi Dan,

I need the resulting height of the rendered html because other text is placed directly after the rendered html text.
But what is the correct way to get the rendered height?

Actually I collect the BlockBoxes and the LineBoxes of the BlockBoxes.
To calculate the height I add the height of each LineBox.
For each BlockBox I add the margin-bottom.
To get the correct height of the rendered HTML I add the sum of LineBox-Height to the sum of margin-bottoms.
The result is exactly right which can be compared with some existing pdf from another system.
But my calculated value I can not find in any property / method of the renderer.
I tried childrenHeight, height, absY, paintinginfo.aggregateBounds and paintinginfo.outerMarginCorner etc but not with the hoped success.

What am I doing wrong because my algorithm is very complicated and I can not belive that this is the right way?

I use the current released version 1.0.1.

Thanks

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.