Welcome Guest Search | Active Topics | Sign In | Register

Problems with offsetTop and offsetHeight in when running Javascript on pdf creation Options
Sri
Posted: Tuesday, February 24, 2015 12:09:02 PM
Rank: Newbie
Groups: Member

Joined: 10/8/2014
Posts: 3
Hi there,

I have a document that I need to mark up with some form of margin. If a paragraph contains spans with a certain set of attributes, the margin should show their references, however if the margin content for a paragraph extends beyond the paragraph any subsequent margin content should be pushed down.

I have achieved this using html and javascript using the offsetTop and offsetHeight properties on the elements to calculate where to put the margin elements and it works fine. However the javascript engine running during pdf generation is giving me back ridiculous offsetTop values for a specific paragraph forcing my margin elements far too far down. This works fine in the browser but breaks when put through your pdf creation process using .

Is there a solution to this bug? would you suggest perhaps doing this with the PDFCreator as a post processing step? If so how would you suggest doing it? I can provide an example html file that highlights the problem if required.

Thanks in advance for your help.
eo_support
Posted: Tuesday, February 24, 2015 10:04:30 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

We have looked into this issue and confirmed this to be a bug related to the following CSS style:

Code: CSS
word-wrap: break-word;


Specifically, when word-wrap is set to break-word, the layout engine will literally break the word on each character. This causes the following HTML to be measured as three lines (one character a line) instead of one line:

Code: HTML/ASPX
<p>abc</p>


The easiest way to avoid this problem is to remove word-wrap: break-word. In the test file you sent to us, you can remove this line in the #editor CSS rule.

If you must use word-wrap: break-word, you can explicitly add a width value to the element. For example, if you change:

Code: HTML/ASPX
<p>abc</p>


To:

Code: HTML/ASPX
<p style="width:200px;">abc</p>


Then this will avoid it to be measured as three lines even if word-wrap: break-word is on.

Hope this helps. Please feel free to let us know if you still have any questions.

Thanks!
Sri
Posted: Wednesday, February 25, 2015 11:32:39 AM
Rank: Newbie
Groups: Member

Joined: 10/8/2014
Posts: 3
Thank you very much for getting back to me, setting the width on the paragraphs worked fine!
eo_support
Posted: Wednesday, February 25, 2015 11:53:42 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
You are very welcome. Glad to hear that it works for you. Please feel free to let us know if there is anything else.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.