Forum How do I...?

How to get div height using JavaScript?

yarbala
I would like to set the font size Depends on the size of the container. To get container height, I tried to use the following code in JS:

myDivHeight = document.getElementById ("myDiv").offsetHeight;


after executing this code - myDivHeight is undefined. I tried to use events: load and complete, but the result is the same.

Are there other ways to get the height and width of the container after parsing html code. Maybe some advise how to set the font size, so that the text entered in the container a certain size in pixels.
mikeday
Currently JavaScript in Prince cannot access the output document after layout has finished. We hope to add support for this in a future release.
JoaoLopes
Any plans of making this work in the near future?
mikeday
Yes. But it will take time.
radvic
You could try to load render the html, use javascript to add the heights (ex. $("#myDiv").height( $("#myDiv").height()) this will write the height as a style attribute in the html, then pass the html as a string to the pdf render script