java - How to apply double line bottom border to a cell in iText -


i need in applying double line bottom border cell , remove other top, right , left borders. able implement dotted line cell borders using below code:

class doublecell implements pdfpcellevent {     public void celllayout(pdfpcell cell, rectangle position,        pdfcontentbyte[] canvases) {       pdfcontentbyte canvas = canvases[pdfptable.linecanvas];       canvas.setlinedash(5f, 5f);       canvas.rectangle(position.getleft(), position.getbottom(),                        position.getwidth(), position.getheight());       canvas.stroke();             }    } 

and pdf code is:

paragraph tableparagraph = new paragraph(); tableparagraph.setalignment(element.align_center); pdfptable table = new pdfptable(2); table.getdefaultcell().setborder(pdfpcell.no_border); font total = new font(font.times_roman, 16); pdfpcell cel3a = new pdfpcell(new paragraph("total",total)); pdfpcell cel3b = new pdfpcell(new paragraph("cell 1",total)); cel3a.setborder(rectangle.no_border); cel3b.setborder(rectangle.no_border ); cel3b.setcellevent(new doublecell()); table.addcell(cel3a); table.addcell(cel3b); tableparagraph.add(table); 

so please assist in applying double line bottom border without other borders.

in code, drawing rectangle:

canvas.rectangle(position.getleft(), position.getbottom(),     position.getwidth(), position.getheight()); canvas.stroke(); 

if want draw 2 lines, need draw 2 lines:

// construct first line: canvas.moveto(position.getleft(), position.getbottom()); canvas.lineto(position.getright(), position.getbottom()); // construct second line (4 user units lower): canvas.moveto(position.getleft(), position.getbottom() - 4); canvas.lineto(position.getright(), position.getbottom() - 4); // draw lines canvas.stroke(); 

please adapt position.getbottom() , position.getbottom() - 4 if want lines @ different position. may want introduce padding cells accommodate lines.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -