ByteScout PDF SDK - VB.NET - Create Tables in PDF - ByteScout

ByteScout PDF SDK – VB.NET – Create Tables in PDF

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF SDK – VB.NET – Create Tables in PDF

How to create tables in PDF in VB.NET with ByteScout PDF SDK

This tutorial will show how to create tables in PDF in VB.NET

Learn how to create tables in PDF in VB.NET with this source code sample. What is ByteScout PDF SDK? It is the SDK for pdf documents generation, modification and updates. Can also generate and fill PDF forms. Provides support for text (fonts, style, size, font family), layers, pdf form fields, vector and raster drawings. It can help you to create tables in PDF in your VB.NET application.

This code snippet below for ByteScout PDF SDK works best when you need to quickly create tables in PDF in your VB.NET application. This VB.NET sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Enjoy writing a code with ready-to-use sample VB.NET codes.

Trial version of ByteScout PDF SDK can be downloaded for free from our website. It also includes source code samples for VB.NET and other programming languages.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.vb
      
Imports Bytescout.PDF ''' <summary> ''' This example demonstrates how to create tables. ''' </summary> Class Program Shared Sub Main() ' Create new document Dim pdfDocument = New Document() pdfDocument.RegistrationName = "demo" pdfDocument.RegistrationKey = "demo" ' Add page Dim page = New Page(PaperFormat.A4) pdfDocument.Pages.Add(page) Dim lightGrayColor = New ColorGray(200) Dim whiteColor = New ColorGray(255) Dim lightBlueColor = New ColorRGB(200, 200, 250) Dim lightRedColor = New ColorRGB(255, 200, 200) ' Create a table and set default background color Dim table = New Table() table.BackgroundColor = lightGrayColor ' Add row headers column and set its color table.Columns.Add(New TableColumn("RowHeaders")) table.Columns(0).BackgroundColor = lightGrayColor ' Add columns A, B, C, ... For c As Integer = 0 To 9 Dim columnName = Convert.ToChar(65 + c).ToString() table.Columns.Add(New TableColumn(columnName, columnName)) Next ' Add rows For r As Integer = 0 To 9 ' Create new row and set its background color Dim row = table.NewRow() row.BackgroundColor = whiteColor ' Set row header text row("RowHeaders").Text = (r + 1).ToString() ' Set cell text For c As Integer = 0 To 9 Dim columnName As String = Convert.ToChar(65 + c).ToString() row(columnName).Text = columnName + (r + 1).ToString() Next ' Add the row to the table table.Rows.Add(row) Next ' Decorate the table table.Rows(1)("B").BackgroundColor = lightRedColor table.Columns(2).BackgroundColor = lightBlueColor table.Rows(1).BackgroundColor = lightBlueColor table.Rows(1)("RowHeaders").BackgroundColor = lightBlueColor ' Draw the table on canvas page.Canvas.DrawTable(table, 20, 20) ' Save document to file pdfDocument.Save("result.pdf") ' Cleanup pdfDocument.Dispose() ' Open document in default PDF viewer app Process.Start("result.pdf") End Sub End Class

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF SDK Home Page

Explore ByteScout PDF SDK Documentation

Explore Samples

Sign Up for ByteScout PDF SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF SDK Home Page

Explore ByteScout PDF SDK Documentation

Explore Samples

Sign Up for ByteScout PDF SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next