Damian Nave wrote: > Hi, > Thanks for that, i think i have figured out the issue... > The two following blocks of code, although they seem like they should act > identically to me, don't. > > This works as expected (with the extra border i don't really need) > > _cbr.setShadingFill(axialPattern); > _cbr.rectangle(element.getPositionx(),PageSize.A4.getHeight()-element.getPos > itiony()-element.getHeight(),element.getWidth(),element.getHeight()); > _cbr.fillStroke(); > > However this doesn't (i got no background colour at all) > > Rectangle rectangle = new > Rectangle(element.getPositionx(),PageSize.A4.getHeight()-element.getPosition > y(),element.getPositionx()+element.getWidth(),PageSize.A4.getHeight()-elemen > t.getPositiony()-element.getHeight() ); > _cbr.setShadingFill(axialPattern); > _cbr.rectangle(rectangle); > _cbr.fillStroke(); > > > Is there a reason why the two of these should be different ?
Yes. In the first, you define a rectangle in Graphics State and you fill it. In the second, you define a rectangle object outside Graphics State. The properties of that object consist of borders, a background, etc... By default the background of that rectangle object is empty. When you add that rectangle to the GS, the default background is used. That's why you don't see a background. You could use a shading pattern as a Color with Rectangle.setBackgroundColor. That would probably be the most elegant solution. -- This answer is provided by 1T3XT BVBA http://www.1t3xt.com/ - http://www.1t3xt.info ------------------------------------------------------------------------------ SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php