How to create a table using PDFsharp?

Redgren Grumbholdt picture Redgren Grumbholdt · Oct 30, 2017 · Viewed 15.2k times · Source

Just started using PDFsharp and it works fine, but now I want to create tables in my PDF, but tried other sources and found nothing.

So far I know how to use graph.drawString().

Answer

With PDFsharp: draw text, draw lines around it.

With MigraDoc (you already added that tag): add a Table to your document and add the columns, rows, and borders you need.

The MigraDoc samples that come with MigraDoc are all C#, but a VB.NET sample can be found on the forum.

VB.NET sample on official PDFsharp/MigraDoc forum:
http://forum.pdfsharp.net/viewtopic.php?f=8&t=3207

C# sample on official site that shows usage of tables:
http://pdfsharp.net/wiki/Invoice-sample.ashx