I am trying to draw a table with PdfPig using the DrawLine method.

I draw my lines using the code shown, for all sides. I am able to get most of the table working, however the last line ends up looking like the image below.

PdfPoint startRow = new(borderStartPointX, borderStartPointY); PdfPoint endRow = new(borderEndPointX , borderEndPointY); DrawLine(startRow, endRow, borderWidth)

Failing last row

What can I do to fix it? How can I make the bottom border start and end properly?

cdincer's user avatar

New contributor

cdincer is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

1

You need to adjust/stretch your points according to line width you use. Otherwise it’s going to have issues like this. You will need to this for top, bottom, left, right etc etc.

I suggest looking into SlapKit for drawing tables on PDF. It’s much easier than building this stuff from scratch.

ibrahim burhan's user avatar

New contributor

ibrahim burhan is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.