|
Rank: Newbie Groups: Member
Joined: 2/11/2015 Posts: 3
|
Hi, I'm trying to convert a HTML file with a set of tables which all have borders. The borders width seems strange when converting the HTML, as the border is 1 or 2 pixels wider than the table. The HTML looks correct in Google Chrome. Picture: I have uploaded the HTML to http://heinelarsen.dk/eopdftest/. Try to use the live demo of EO PDF http://www.essentialobjects.com/Products/EOPdf/UrlToPdf.aspx and see the result. Can you help me with this bug? Thanks.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
This is normal. PDF uses float numbers instead integer pixel numbers for everything and the default resolution on screen is usually 96 DPI, whereas the internal "DPI" on a PDF is 72 DPI. This always result in an exact integer value on screen becoming a float number with fractions inside PDF. When a PDF Viewer converts this number back and forth and tries to align it to the screen pixels, it can introduce accumulated errors and eventually be one or two pixels off. The error usually disappear when you zoom in. For example, a 1 pixel and 2 pixels line can appear the same in a PDF with initial zoom level but when you zoom in, you will see the 2 pixel lines are wider than the 1 pixel line.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 2/11/2015 Posts: 3
|
Hi,
Thank you for your answer. Just to be sure I understand you correct: it is not possible to create tables with borders like in my example where the borders will align in the PDF? I believe I have tried everything and the result is not nice when the borders er one or two pixels off.
Thanks.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
You are correct. However while in theory it is not possible, in practice this happens more often in some scenarios than in other scenarios. For example, if your table does not have round corners, then the chances of getting a straight line would be higher. This is because the engine might decide to use a single "DrawLine" command to draw the whole right edge instead of using two different commands (DrawArc, then DrawLine). However there is no guarantee on that because we are not at liberty of defining browser engine's drawing behaviors (we could modify it, but there would be too many places and the chance of breaking something would be too high). So you might want to try to use a simpler style while exporting to PDF.
|
|
Rank: Newbie Groups: Member
Joined: 2/11/2015 Posts: 3
|
Thanks again, I have tried many things with the tables. Removed the content, removed styling and the rounded corners, but I have not seen a pdf conversion with align borders yet. Is this possible and how?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
To be honest with you we do not know how either ---- we've seen both but we do not have a magic recipe to make Adobe Reader to always render flawless line junction. In most document from Adobe themselves they only have tables with horizontal lines. So that might be one thing you can consider. Another way to make flawless table is to use SVG. SVG explicitly describes multiple lines as "Path" and multiple links inside the same Path are linked by definition, in this case we would translate this into a Path object in the PDF file and Adobe Render will render that flawless since it knows those lines suppose to be linked. However it might be a bit over kill for this purpose.
In the future we might consider modifying the browser engine to render the table lines as path as well (currently they are rendered as multiple unrelated lines, that's why Adobe Reader does not know that they suppose to be linked to each other). However that would be a big undertaken so we are not sure when it will be implemented yet.
Thanks!
|
|