public void CellLayout(PdfPCell cell, iTextSharp.text.Rectangle rect, PdfContentByte[] canvases) { //draw line 1 PdfContentByte cb = writer.DirectContent; cb.MoveTo(rect.GetLeft(0), rect.GetBottom(0) - padding); cb.LineTo(rect.GetRight(0), rect.GetBottom(0) - padding); //draw line 2 cb.MoveTo(rect.GetLeft(0), rect.GetBottom(0) - padding - 2); cb.LineTo(rect.GetRight(0), rect.GetBottom(0) - padding - 2); cb.Stroke(); }
/// <summary> /// Metodo para manejar los eventos de las celdas /// </summary> /// <param name="celda"></param> /// <param name="posicion"></param> /// <param name="canvass"></param> public void CellLayout(PdfPCell celda, iTextSharp.text.Rectangle posicion , PdfContentByte[] canvass) { float x1 = posicion.GetLeft(0) + 2; float x2 = posicion.GetRight(0) - 2; float y1 = posicion.GetTop(0) - 2; float y2 = posicion.GetBottom(0) + 2; PdfContentByte canvas = canvass[PdfPTable.LINECANVAS]; canvas.Rectangle(x1, y1, x2 - x1, y2 - y1); canvas.Stroke(); canvas.ResetRGBColorStroke(); }
public void CellLayout(PdfPCell cell, iTextSharp.text.Rectangle rect, PdfContentByte[] canvases) { //Create the field's rectangle based on the current cell and requested padded var newRect = new PdfRectangle(rect.GetLeft(Padding), rect.GetBottom(Padding), rect.GetRight(Padding), rect.GetTop(Padding)); //Set the appearance's rectangle to the same as the box Field.Box = newRect.Rectangle; //Get the raw field var tf = this.Field.GetTextField(); //Change the field's rectangle tf.Put(PdfName.RECT, newRect); //Add the annotation to the writer Writer.AddAnnotation(tf); }