Hi, I have problems with rounded corners. If I use the cb directly here and
don't create a Pdftemplate everythings works fine with the rounded corners
but if the background I set every block in my page will get them.

cell.setCellEvent( new PdfPCellEvent(){
  public void cellLayout(PdfPCell cell, Rectangle rect,PdfContentByte[]
canvas) {
  // Here I have tried to just add it to the PdfContentByte but then every
block 
  // is the color of the last block. I've tried cb.saveState() and
restoreState() but without luck                                 
  PdfContentByte cb = canvas[PdfPTable.LINECANVAS];
  PdfTemplate template = cb.createTemplate( rect.getWidth() ,
rect.getHeight());

  if( getBorder() != null ){
    template.setLineWidth( MeasurementUtil.millimetersToPostscriptPoints(
getBorder().getThickness()) );
    template.setColorStroke( getPage().getPdfDocument().getColors().get(
getBorder().getColorReference() ));
  }
                                        
  if( getBackgroundReference() != null ){
    template.setColorFill( getPage().getPdfDocument().getColors().get(
getBackgroundReference() ));
  }
                                        
  template.roundRectangle(0 , 0, rect.getWidth() ,rect.getHeight() ,
MeasurementUtil.millimetersToPostscriptPoints( getRadius() ));
                                        
  if( getBackgroundReference() != null || getBorder() != null ){
    if( getBackgroundReference() != null && getBorder() != null ){
      template.fillStroke();
    }else if( getBackgroundReference() != null ){
      template.fill();
    }else{
      template.stroke();
    }
  }

  cb.addTemplate( template, rect.getLeft(), rect.getBottom());
}});
-- 
View this message in context: 
http://old.nabble.com/problem-with-rounded-corners-tp28328340p28328340.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to