Welcome Guest Search | Active Topics | Sign In | Register

Html to PDF: Paging text lines with pt font-size Options
nikfe
Posted: Monday, October 24, 2016 8:06:18 AM
Rank: Member
Groups: Member

Joined: 5/25/2015
Posts: 21
Hi

I noticed that when using pt unit with font-size text lines might duplicate (invisibly) near page brakes. Here its dummy test source and result (conversion done with online live demo):
http://pastebin.com/vLhYNEy9
https://s9.postimg.org/aco6m4ysf/lines_A.png

In real usage this might cause visible artifacts but I wasn't able to reproduce this kind of behaviour quickly with dummy data:https://s9.postimg.org/aqpilqivx/lines_B.png

There is propably some rounding error since if I use raw px-unit everything is working fine.

FYI: This bug also exists with our custom pager.
eo_support
Posted: Monday, October 24, 2016 8:42:40 AM
Rank: Administration
Groups: Administration

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

We tested and we do not see the gray "amature" text shown in the picture you posted on the first page.

We are not aware of that font size is pt or px matters to the conversion, but line height matters. You can get text line being split in the middle if your text line height is too small.

Thanks!
nikfe
Posted: Monday, October 24, 2016 10:47:38 AM
Rank: Member
Groups: Member

Joined: 5/25/2015
Posts: 21
Hi

Ghost line looks like that when its selected and browser is unfocused (and that is viewer spesific I think). So basicly it's fully invisible but this text element still exists and you can select it.

There is video about if it shows situation more clearly: https://dl.dropboxusercontent.com/u/40264849/2016-10-24%2015-59-01.mp4

Yea unit is not a actual root cause since you get same result if you set font-size as 13.33333333333px; but 10pt is more common case to get there... Yep line-height is related but this is not caused by too small line-height. I feel that when line-height is incrasing, propability is going down but issue still exists. For example if you replace rules in example with these you still get shadow text line even that line-height is clearly big enought:

p {
font-size: 13.33333333333px;
line-height: 1.876;
}

Ghost line might also be at the begin of the page (but it feels to be more rare). This happen for example:

p {
font-size: 13.43333333333px;
}

I am not still found any case where there are ghost elements with px integer. Sure this particular situation is not a big problem (when texts are really hidden) but it propably take up to few days that I can divide visible glitch error from our system. Anyway the fact that there is unwanted text element is not far the situation that there is partially visible text...
eo_support
Posted: Monday, October 24, 2016 1:59:23 PM
Rank: Administration
Groups: Administration

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

This makes sense. Internally we use pixel position to cut the page. The paging is done after layout, so for example if we have two lines of text with the following height:

Line 1: 50px
Line 2: 25px

And if the page is 60 px high then a page break will be inserted immediately after Line 1 since there isn't enough room to place line 2 on the same page. Page 1 in PDF will represent a rendering of from 0 to 50 px in the web page and clearly include line 1 and exclude line 2.

This would have problem if the line height is like this:

Line 1: 49.8px
Line 2: 25 px

In this case the paging will still be inserted at 50px because 49.8px is rounded to 50. In this case page 1 in PDF will still represent a rendering of from 0 to 50 px in the web page, however this same range now includes a tiny hair of line 2 since line 2 starts from 49.8px and the page breaks at 50 px. Visually this usually does not cause any problem because it can only be off half a pixel at most. However that is enough to trigger the underlying engine to include the ghost text due to the y position overlaps with the text line.

To complete resolves this issue, we need to systematically support sub pixel values (which the browser engine itself already support hence the issue you see) and this will be quite an undertaken. So I do not see this to be resolved right away. We will look into it to see if it is possible for us to support that.

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.