Articles in this section
Category / Section

How to draw grid in PDF with conformance?

2 mins read

Syncfusion Essential PDF is a .NET PDF library used to create, read, and edit PDF documents. Using this library, you can draw grid in conformance PDF or PDF/A-1b using C# and VB.NET.

Steps to draw grid in PDF with the conformance

  1. Create a new C# console application project. Create new console application in .NET PDF library
  2. Install the Syncfusion.Pdf.WinForms NuGet package as a reference to your  .NET Framework applications from Install nuget packages in .NET PDF library
  3. Include the following namespaces in the Program.cs file.


using Syncfusion.Pdf;
using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf.Grid;
using System.Data;
using System.Drawing;



Imports Syncfusion.Pdf
Imports Syncfusion.Pdf.Graphics
Imports Syncfusion.Pdf.Grid
Imports System.Data
Imports System.Drawing


  1. Use the following code snippet to draw grid or table in PDF/A-1b document.


//Create a new PDF document
PdfDocument doc = new PdfDocument(PdfConformanceLevel.Pdf_A1B);
//Add a page
PdfPage page = doc.Pages.Add();
//Create a PdfGrid
PdfGrid pdfGrid = new PdfGrid();
pdfGrid.Style.Font = new PdfTrueTypeFont(new Font("Arial Unicode MS", 14), true);
//Create a DataTable
DataTable dataTable = new DataTable();
//Add columns to the DataTable
//Add rows to the DataTable
dataTable.Rows.Add(new object[] { "E01", "Mark" });
dataTable.Rows.Add(new object[] { "E02", "Chad" });
//Assign data source
pdfGrid.DataSource = dataTable;
//Draw grid to a page of the PDF document
pdfGrid.Draw(page, new PointF(10, 10));
//Save the document
//Close the document



'Create a new PDF document
Dim doc As New PdfDocument(PdfConformanceLevel.Pdf_A1B)
'Add a page
Dim page As PdfPage = doc.Pages.Add()
'Create a PdfGrid
Dim pdfGrid As New PdfGrid()
pdfGrid.Style.Font = New PdfTrueTypeFont(New Font("Arial Unicode MS", 14), True)
'Create a DataTable
Dim dataTable As New DataTable()
'Add columns to the DataTable
'Add rows to the DataTable
dataTable.Rows.Add(New Object() {"E01", "Mark"})
dataTable.Rows.Add(New Object() {"E02", "Chad"})
'Assign data source
pdfGrid.DataSource = dataTable
'Draw grid to a page of the PDF document
pdfGrid.Draw(page, New PointF(10, 10))
'Save the document
'Close the document


You can download the work sample from PdfGridConformanceSample.Zip

By executing the program, you will get the PDF document as follows. Screenshot of output PDF file in .NET PDF library

Take a moment to peruse the documentation, where you will find other options like drawing right-to-left text and multi-column text, consuming TrueType fonts, Standards fonts, CJK fonts. Also, the features like PDF form filling, extract text or images from PDF, protect PDF documents with code examples.


Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer to link to learn about generating and registering Syncfusion license key in your application to use the components without trail message.



Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment