public PdfPCellEvent createEvent(final Block block ){ return new PdfPCellEvent(){ public void cellLayout(PdfPCell cell, Rectangle rect,PdfContentByte[] canvas) { float radiusInPs = SizeFactory.millimetersToPostscriptPoints( block.getRadius() ); PdfContentByte cb = canvas[PdfPTable.LINECANVAS]; PdfTemplate template = cb.createTemplate( rect.getWidth() , rect.getHeight()); template.roundRectangle(0, 0, rect.getWidth() ,rect.getHeight() , radiusInPs); template.clip(); template.newPath(); if( block.getBaseColor() != null ){ template.setColorFill(block.getBaseColor()); } Border border = block.getBorder(); if( border != null ){ template.setLineWidth( SizeFactory.millimetersToPostscriptPoints( border.getThickness()) ); template.setColorStroke( border.getBaseColor()); } template.roundRectangle(0, 0, rect.getWidth() ,rect.getHeight() ,radiusInPs); if( block.getBaseColor() != null || border != null ){ if( block.getBaseColor() != null && border != null ){ template.fillStroke(); }else if( block.getBaseColor() != null ){ template.fill(); }else{ template.stroke(); } } cb.addTemplate( template, rect.getLeft(), rect.getBottom()); } }; }