c# - problem in drawing a line in a pdf file using itextsharp -
i generating pdf file in asp.net c# using itextsharp. not able draw horizontal line/verticle line/dotted line.
i tried draw line using following code,i getting no errors line not getting displayed in pdf file
pdfcontentbyte cb = wri.directcontent; cb.setlinewidth(2.0f); // make bit thicker 1.0 default cb.moveto(20, pdfdocument.top - 40f); cb.lineto(400, pdfdocument.top - 40f); cb.stroke();
what problem in code.is because of position of x y co-ordinates? had used rough points know approximate position in pdf,but line never apears in pdf file.
the output looking out shown in image below.
you should make sure set color operation you're performing, otherwise won't know you'll (it whatever previous operation performed). try doing cb.setstrokecolor(255, 0, 0) (pure red) until line want it.
Comments
Post a Comment