Cell border rendering error (thicker) with number-column-spanned

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Cell border rendering error (thicker) with number-column-spanned

zhangwei
I've met with a problem with thicker table border with number-column-spanned on FOP 1.0.
The copied text exactly describes the same problem I have.

When zoomed to 100% or 200% in Adobe reader, you can find the thicker line.

Any idea? Seems like it's a bug of FOP, if so, can anyone fix it or point the Java file I should go?

Adobe Reader: 8.3.1
FOP: 1.0
FO:
<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
        xmlns:html="http://www.w3.org/1999/xhtml" role="html:html">
        <fo:layout-master-set>
                <fo:simple-page-master page-width="auto"
                        page-height="auto" master-name="all-pages">
                        <fo:region-body />
                        <fo:region-before />
                        <fo:region-after />
                        <fo:region-start />
                        <fo:region-end  />
                </fo:simple-page-master>
        </fo:layout-master-set>
        <fo:page-sequence master-reference="all-pages">
                <fo:flow flow-name="xsl-region-body">
                        <fo:block role="html:body">
                                <fo:table >
                                        <fo:table-column number-columns-repeated="3"
                                                role="html:colgroup" />
                                        <fo:table-body border-collapse="collapse">
                                                <fo:table-row>
                                                        <fo:table-cell
                                                                number-columns-spanned="3" border="1px" border-style="solid"
                                                                role="html:td">
                                                                <fo:block>test text
                        </fo:block>
                                                        </fo:table-cell>
                                                </fo:table-row>
                                                <fo:table-row>
                                                        <fo:table-cell
                                                                number-columns-spanned="3" border="1px" border-style="solid"
                                                                role="html:td">
                                                                <fo:block>test text
                        </fo:block>
                                                        </fo:table-cell>
                                                </fo:table-row>
                                        </fo:table-body>
                                </fo:table>
                        </fo:block>
                </fo:flow>
        </fo:page-sequence>
</fo:root>

Copied:
I found that using the attribute number-column-spanned inside a cell element, I get a bad rendering of the cell border: it gets thicker in the central section of the border.

http://permalink.gmane.org/gmane.text.xml.fop.user/30912
Reply | Threaded
Open this post in threaded view
|

RE: Cell border rendering error (thicker) with number-column-spanned

Theresa Jayne Forster
I have seen that but I don't think it's actually bigger, it seems to be when
the reader tries to show a 1 pixel (for example) line it guestimates it as 2
pixels, as pixels on document and pixels on zoomed viewer do not necessarily
match, the other day SumatraPDF was showing all Letter l characters as
double thickness/bold but when zoomed in or printed they looked ok.


Kindest regards


Theresa Forster
Senior Software Developer

-----Original Message-----
From: zhangwei [mailto:[hidden email]]
Sent: 10 February 2012 09:14
To: [hidden email]
Subject: Cell border rendering error (thicker) with number-column-spanned


I've met with a problem with thicker table border with number-column-spanned
on FOP 1.0.
The copied text exactly describes the same problem I have.

When zoomed to 100% or 200% in Adobe reader, you can find the thicker line.

Any idea? Seems like it's a bug of FOP, if so, can anyone fix it or point
the Java file I should go?

Adobe Reader: 8.3.1
FOP: 1.0
FO:
<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
        xmlns:html="http://www.w3.org/1999/xhtml" role="html:html">
        <fo:layout-master-set>
                <fo:simple-page-master page-width="auto"
                        page-height="auto" master-name="all-pages">
                        <fo:region-body />
                        <fo:region-before />
                        <fo:region-after />
                        <fo:region-start />
                        <fo:region-end  />
                </fo:simple-page-master>
        </fo:layout-master-set>
        <fo:page-sequence master-reference="all-pages">
                <fo:flow flow-name="xsl-region-body">
                        <fo:block role="html:body">
                                <fo:table >
                                        <fo:table-column
number-columns-repeated="3"
                                                role="html:colgroup" />
                                        <fo:table-body
border-collapse="collapse">
                                                <fo:table-row>
                                                        <fo:table-cell
       
number-columns-spanned="3" border="1px" border-style="solid"
       
role="html:td">
       
<fo:block>test text
                        </fo:block>
                                                        </fo:table-cell>
                                                </fo:table-row>
                                                <fo:table-row>
                                                        <fo:table-cell
       
number-columns-spanned="3" border="1px" border-style="solid"
       
role="html:td">
       
<fo:block>test text
                        </fo:block>
                                                        </fo:table-cell>
                                                </fo:table-row>
                                        </fo:table-body>
                                </fo:table>
                        </fo:block>
                </fo:flow>
        </fo:page-sequence>
</fo:root>

Copied:
I found that using the attribute number-column-spanned inside a cell
element, I get a bad rendering of the cell border: it gets thicker in the
central section of the border.

http://permalink.gmane.org/gmane.text.xml.fop.user/30912
--
View this message in context:
http://old.nabble.com/Cell-border-rendering-error-%28thicker%29-with-number-
column-spanned-tp33298921p33298921.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Cell border rendering error (thicker) with number-column-spanned

Chris Bowditch
In reply to this post by zhangwei
On 10/02/2012 09:14, zhangwei wrote:

Hi,
> I've met with a problem with thicker table border with number-column-spanned
> on FOP 1.0.
> The copied text exactly describes the same problem I have.
>
> When zoomed to 100% or 200% in Adobe reader, you can find the thicker line.

What about when you zoom to 800% or higher? Also, does the problem
appear when you print the PDF?


>
> Any idea? Seems like it's a bug of FOP, if so, can anyone fix it or point
> the Java file I should go?

It's not a bug of FOP, but down to the use of thin lines on low
resolution devices and how different PDF Viewers handles this.

1px is a very thin line. 1pt should be the minimum really to ensure you
don't see strange affects like this on screen.

Adobe Reader does have some options that you can disable to improve the
way thin lines are drawn at 100% zoom. Ensure the option "Enhance Thin
Lines" is disabled

Chris

>
> Adobe Reader: 8.3.1
> FOP: 1.0
> FO:
> <?xml version="1.0" encoding="UTF-8"?>
> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
> xmlns:html="http://www.w3.org/1999/xhtml" role="html:html">
> <fo:layout-master-set>
> <fo:simple-page-master page-width="auto"
> page-height="auto" master-name="all-pages">
> <fo:region-body />
> <fo:region-before />
> <fo:region-after />
> <fo:region-start />
> <fo:region-end  />
> </fo:simple-page-master>
> </fo:layout-master-set>
> <fo:page-sequence master-reference="all-pages">
> <fo:flow flow-name="xsl-region-body">
> <fo:block role="html:body">
> <fo:table>
> <fo:table-column number-columns-repeated="3"
> role="html:colgroup" />
> <fo:table-body border-collapse="collapse">
> <fo:table-row>
> <fo:table-cell
> number-columns-spanned="3" border="1px" border-style="solid"
> role="html:td">
> <fo:block>test text
> </fo:block>
> </fo:table-cell>
> </fo:table-row>
> <fo:table-row>
> <fo:table-cell
> number-columns-spanned="3" border="1px" border-style="solid"
> role="html:td">
> <fo:block>test text
> </fo:block>
> </fo:table-cell>
> </fo:table-row>
> </fo:table-body>
> </fo:table>
> </fo:block>
> </fo:flow>
> </fo:page-sequence>
> </fo:root>
>
> Copied:
> I found that using the attribute number-column-spanned inside a cell
> element, I get a bad rendering of the cell border: it gets thicker in the
> central section of the border.
>
> http://permalink.gmane.org/gmane.text.xml.fop.user/30912


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Cell border rendering error (thicker) with number-column-spanned

reevev
Hi,

This does appear to be a fop bug and not a rendering issue.  We have templates that render correctly with fop 0.20.5, however in fop 1.0 we are seeing this exact issue with the middle section of the spanned columns showing a thicker border.

Has anyone found a solution to this issue?

Note the issue is still present when zooming in to 800%.

Thanks,

Reeve.
Reply | Threaded
Open this post in threaded view
|

Re: Cell border rendering error (thicker) with number-column-spanned

Pascal Sancho-2
Hi,
border drawing design is quite different in FOP current Vs FOP 0.2x.
The former was quite imprecise, and could not easily support extended
border features.

I've tried your test case (from archive [1]) against Acrobat Reader X,
and at normal zoom the display depends on "Enhance Thin Lines" option;
if checked, there is no issue.

When zooming, the issue disappears. So this appears to be related on
how the viewer shows little objects

[1] http://apache-fop.1065347.n5.nabble.com/Cell-border-rendering-error-thicker-with-number-column-spanned-td17999.html#a37226

2012/11/2 reevev <[hidden email]>:
> Hi,
>
> This does appear to be a fop bug and not a rendering issue.  We have
> templates that render correctly with fop 0.20.5, however in fop 1.0 we are
> seeing this exact issue with the middle section of the spanned columns
> showing a thicker border.
> Has anyone found a solution to this issue?
> Note the issue is still present when zooming in to 800%.


--
pascal

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Cell border rendering error (thicker) with number-column-spanned

reevev
Hi,

Thanks for your reply.  While I can confirm that disabling "Enhance thin lines" corrects the display it doesn't solve the issue that the same templates rendered correctly even with this option enabled when we use 0.20.5 to generate the pdf.

Our issue is that "Enhance thin lines" is turned on by default and for most users they will end up seeing a poor looking PDF now that we've started using Fop 1.0, vs. a correct looking PDF prior to the upgrade, so from the end user's perspective this is broken.  Is there any way we can have the same sort of rendering used in 0.20.5 for table borders?

Thanks,

Reeve.
Reply | Threaded
Open this post in threaded view
|

Re: Cell border rendering error (thicker) with number-column-spanned

Chris Bowditch
On 02/11/2012 13:55, reevev wrote:
> Hi,

Hi Reeve,

>
> Thanks for your reply.  While I can confirm that disabling "Enhance thin
> lines" corrects the display it doesn't solve the issue that the same
> templates rendered correctly even with this option enabled when we use
> 0.20.5 to generate the pdf.
>
> Our issue is that "Enhance thin lines" is turned on by default and for most
> users they will end up seeing a poor looking PDF now that we've started
> using Fop 1.0, vs. a correct looking PDF prior to the upgrade, so from the
> end user's perspective this is broken.  Is there any way we can have the
> same sort of rendering used in 0.20.5 for table borders?

No such option exists today. However, FOP is an open source project, so
patches are welcome :)

However, please be warned that the table border drawing code is very
complicated so altered the way borders are drawn to work around Acrobat
bugs will not be trivial.

Thanks,

Chris

>
> Thanks,
>
> Reeve.
>
>
>
> --
> View this message in context: http://apache-fop.1065347.n5.nabble.com/Cell-border-rendering-error-thicker-with-number-column-spanned-tp17999p37229.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Cell border rendering error (thicker) with number-column-spanned

Luis Bernardo
In reply to this post by reevev

First, I understand why this issue is annoying. When I open the document
Adobe defaults in my monitor to a 170% zoom and the problem is clearly
visible. Incidentally the problem is not visible at 100%.

But I looked at the document and can guarantee that the problem is with
Adobe Reader. The thickness of the segments are always the same. In FOP
0.20.5 the cell that spans three columns is drawn with 4 segments. In
FOP 1.0 the cell is drawn with 8 segments. Maybe due to some rounding
error Adobe is drawing the middle segments at a different thickness for
some magnification values, but in the PDF the thickness is always the same.

I suggest you change your table layout. Maybe by nesting tables you can
achieve the same visual output without needing to use spanning across
columns...

On 11/2/12 1:55 PM, reevev wrote:

> Hi,
>
> Thanks for your reply.  While I can confirm that disabling "Enhance thin
> lines" corrects the display it doesn't solve the issue that the same
> templates rendered correctly even with this option enabled when we use
> 0.20.5 to generate the pdf.
>
> Our issue is that "Enhance thin lines" is turned on by default and for most
> users they will end up seeing a poor looking PDF now that we've started
> using Fop 1.0, vs. a correct looking PDF prior to the upgrade, so from the
> end user's perspective this is broken.  Is there any way we can have the
> same sort of rendering used in 0.20.5 for table borders?
>
> Thanks,
>
> Reeve.
>
>
>
> --
> View this message in context: http://apache-fop.1065347.n5.nabble.com/Cell-border-rendering-error-thicker-with-number-column-spanned-tp17999p37229.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Cell border rendering error (thicker) with number-column-spanned

reevev
Hi,

The problem exists with other PDF viewers as well. I've tried foxit reader and it has the same issues.

We are looking at re-writing templates not to use spanned columns where possible, and for other cases where this is not possible we will have to fall back to fop 0.20.5 which works as expected.

This is  definitely a fop isuse and not an Adobe Reader issue.  The fact that we have a template transformed to pdf in fop 0.20.5 which renders correctly in both Adobe Reader and Foxit Reader, yet when transformed with fop 1.0 it renders incorrectly in both Adobe Reader and Foxit Reader points to a fop issue.  The only part of the equation that has changed is replacing fop 0.20.5 with fop 1.0.

We'll just treat it as a bug and if we get time to look into the source ourselves we will do so, otherwise will have to be mindful of the issue going forward.

Thanks,

Reeve.
Reply | Threaded
Open this post in threaded view
|

Re: Cell border rendering error (thicker) with number-column-spanned

Luis Bernardo

Attached is a hand crafted PDF that shows the issue. It was not created
with FOP.

You can open the PDF with notepad or similar and check the drawing
commands to confirm that the thickness of the segments is the same.

On 11/3/12 11:37 PM, reevev wrote:

> Hi,
>
> The problem exists with other PDF viewers as well. I've tried foxit reader
> and it has the same issues.
>
> We are looking at re-writing templates not to use spanned columns where
> possible, and for other cases where this is not possible we will have to
> fall back to fop 0.20.5 which works as expected.
>
> This is  definitely a fop isuse and not an Adobe Reader issue.  The fact
> that we have a template transformed to pdf in fop 0.20.5 which renders
> correctly in both Adobe Reader and Foxit Reader, yet when transformed with
> fop 1.0 it renders incorrectly in both Adobe Reader and Foxit Reader points
> to a fop issue.  The only part of the equation that has changed is replacing
> fop 0.20.5 with fop 1.0.
>
> We'll just treat it as a bug and if we get time to look into the source
> ourselves we will do so, otherwise will have to be mindful of the issue
> going forward.
>
> Thanks,
>
> Reeve.
>
>
>
> --
> View this message in context: http://apache-fop.1065347.n5.nabble.com/Cell-border-rendering-error-thicker-with-number-column-spanned-tp17999p37241.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

adobe-bug.pdf (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Cell border rendering error (thicker) with number-column-spanned

reevev
Hi,

Thanks for providing the sample.  I agree that this illustrates that the various PDF viewers are not doing the right thing with the line thickness and I'm not disagreeing with this point.  However the fact remains that fop 0.20.5 output the borders in a method that the PDF viewers displayed correctly and newer versions of fop don't produce the desired output.

By changing to fop 1.0 (or 1.1) we now are seeing output that isn't rendered correctly in the industry standard PDF viewer, as well as other common PDF viewers, and this is why I say the bug is with FOP.  It may be technically correct output, but if it isn't displayed correctly anywhere it is besides the point.

Is there somewhere I can find out more on why the border rendering was changed?  I'm guessing there was a reason it was changed.  If I wanted to change the source so it rendered the old way it would probably create different issues that I'm not aware of.

Thanks,

Reeve.
Reply | Threaded
Open this post in threaded view
|

Re: Cell border rendering error (thicker) with number-column-spanned

Jeremias Maerki-2
Hi Reeve,
the reason for the change was to support line styles other than "solid",
"dashed" and "dotted" and the collapsing border model on tables. 0.20.5
painted simple lines, resulting in rectangles that effectively
overlapped (potentially producing ugly side-effects themselves). During
the redesign this was changed to using clip paths to cut the lines to
the exact shape that we need. Notes at [1] show why the current model
was chosen. Over time, it has come up a number of times (this isn't the
first time) that anti-aliassing features in various PDF viewers cause
suboptimal results (on screen only, NEVER in print because there is no
anti-aliassing there) with FOP's current approach.

To fix the problem and still preserve the current feature-richness,
there will need to be improvements on the way borders are painted, but
they will not be easy to implement:

The painting of the border grid of a table has to be changed to
group the painting of border segments together. The IFRenderer would
have to be extended with an optimizer of some sorts that can try (!) to
combine the various grid segments to larger combined structures, ex.
longer lines of the same color. That may even have an influence on the
structure of the area tree. There's also a relationship to the z-index
feature (grouping, buffering and ordering of painting operations).
Different line thicknesses may effectively get in the way of that
optimization.

Ideally, a table with a simple black grid would be painted with just the
minimal set of lines (without clip paths). That would basically
guarantee no side-effects. But that is only possible for the simple
cases. More complex cases require the "tricks" we use here to paint the
border segments and that may easily lead to the unwanted visual
artifacts we're seeing today. So, I don't think there is a silver bullet.
There's room for optimization but not without an influence on the code
complexity. And all that just because some PDF viewers produce different
results for two lines with the same thickness. OTOH, it has the
potential to produce slightly smaller output files.

Anti-aliassing's a bitch that's great for text but only produces issues
with vector graphics.

I do remember extensive discussions on border painting during 2003/2004
that effectively showed the complexity of getting border painting "right".

[1] http://wiki.apache.org/xmlgraphics-fop/CollapsingBorderModel

Jeremias Maerki


On 04.11.2012 05:16:10 reevev wrote:

> Hi,
>
> Thanks for providing the sample.  I agree that this illustrates that the
> various PDF viewers are not doing the right thing with the line thickness
> and I'm not disagreeing with this point.  However the fact remains that fop
> 0.20.5 output the borders in a method that the PDF viewers displayed
> correctly and newer versions of fop don't produce the desired output.
>
> By changing to fop 1.0 (or 1.1) we now are seeing output that isn't rendered
> correctly in the industry standard PDF viewer, as well as other common PDF
> viewers, and this is why I say the bug is with FOP.  It may be technically
> correct output, but if it isn't displayed correctly anywhere it is besides
> the point.
>
> Is there somewhere I can find out more on why the border rendering was
> changed?  I'm guessing there was a reason it was changed.  If I wanted to
> change the source so it rendered the old way it would probably create
> different issues that I'm not aware of.
>
> Thanks,
>
> Reeve.
>
>
>
> --
> View this message in context: http://apache-fop.1065347.n5.nabble.com/Cell-border-rendering-error-thicker-with-number-column-spanned-tp17999p37244.html
> Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]