While testing / implementing padding and background-image support for
table cells I think I have come across a bug with the PDF renderer.
Unfortunately I cannot provide a testcase as one would need my version
of fop for this. Any way, it is along the following lines: Background
images on absolute positioned blocks (I am talking area tree here) are
incorrectly offset, that is the left-position and top-position traits
are applied multiple times. It works ok for blocks that are viewports
(as created from fo:block-container) but for "normal" absolute blocks
as generated for table cells it doesn't.
I made the following change to the PDFRenderer, that is commented out
the offset calculation involving currentIPPosition / currentBPPosition
as these offsets are already included in x and y.
protected void placeImage(float x, float y, float w, float h, int
xobj) {
saveGraphicsState();
currentStream.add(w + " 0 0 "
+ -h + " "
+ (/*currentIPPosition / 1000f*/ + x) + " "
+ (/*currentBPPosition / 1000f*/ + h + y)
+ " cm\n" + "/Im" + xobj + " Do\n");
restoreGraphicsState();
}
This seems to work but I am not sure about any unforeseen side effects.
Someone with a better grasp of the PDFRenderer than me may want to take
a look at this please.
Manuel