Hi all,
 
I'm using PdfPTables to build the PDF output to mimic on-screen (i.e. HTML)
tabular report output but with much better printed rendering.  Our style
guide calls for different cell background and border colors in the table
header and the table body.  In addition, the table header borders are
strictly interior to the header.  In other words, the outside edge of the
header area is the same color as the background of those cells.
 
I started out doing what I thought was relatively obvious.  I set a border
color for the entire cell (using PdfPCell.setBorderColor) and then used
different border colors to override the left, right, top, and/or bottom
depending on the position of the cell in the header.  This didn't quite come
out as I'd planned.  All the border colors were the color set using
setBorderColor.  So, I started looking at the code and quickly noticed that
if I had variable width borders, or called setUseVariableWidthBorders(true),
then completely different border rendering code was invoked.  It's also
quite clear that there are paths thru the code that will either not draw the
border color (if borderColor is null but hasBorder(Rectangle.BOX) is true)
or will not use the side-specific border colors (if hasBorder(Rectangle.BOX)
is false).
 
If the variable width border mode is in effect, there are several
differences to how the borders are drawn.  The colors are taken from each of
the sides as are the widths.  The code also adjusts the line caps and joins.
Further, it seems to interpret the border width value differently.  In some
cases it seems to give double the width of the border that would have been
drawn if variable width border mode is off.

I'm curious about what is the best path forward.  I did an experiment that
forced hasBorder(Rectangle.BOX) to be false (I disabled the bottom side
border in the table header) and added code to each left, right, top, and
bottom portions of the else block to get the side-specific border color.
This works fine for me.  But, while my table is clearly different than
others have used for iText, I can imagine that the variable width behaviors
(specifically, the cap and join calculations) would be better if more color
variation were used in the borders.  I have code I could submit if this
outcome was thought to be appropriate.

I'm about to have a much closer look at PdfContentByte.variableRectangle to
see if I can figure out a way to make it not double the border widths where
I don't want that behavior.  I'm a bit concerned that with variable width
borders, I'll need to specially handle all outside edge cells (not just the
table header outside edge cells) to get the drawn width of the border to be
visually the same on the outside edges as it is in the interior of the table
body.  But maybe that's unavoidable.

Thoughts anyone?  Have I been clear or should I provide some additional
details?  I don't have a small reproduction program but can build one if
needed.

Thanks,
  Rick Berman



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to