ByteScout Premium Suite - VB.NET - Add page numbers to pdf with pdf sdk - ByteScout

ByteScout Premium Suite – VB.NET – Add page numbers to pdf with pdf sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout Premium Suite – VB.NET – Add page numbers to pdf with pdf sdk

How to add page numbers to pdf with pdf sdk in VB.NET using ByteScout Premium Suite

Continuous learning is a crucial part of computer science and this tutorial shows how to add page numbers to pdf with pdf sdk in VB.NET

Add page numbers to pdf with pdf sdk is simple to apply in VB.NET if you use these source codes below. ByteScout Premium Suite: the bundle that includes twelve SDK products from ByteScout including tools and components for PDF, barcodes, spreadsheets, screen video recording. It can add page numbers to pdf with pdf sdk in VB.NET.

Want to save time? You will save a lot of time on writing and testing code as you may just take the VB.NET code from ByteScout Premium Suite for add page numbers to pdf with pdf sdk below and use it in your application. Follow the instructions from scratch to work and copy the VB.NET code. Applying VB.NET application mostly includes various stages of the software development so even if the functionality works please test it with your data and the production environment.

All these programming tutorials along with source code samples and ByteScout free trial version are available for download from our website.

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 Imports Font = Bytescout.PDF.Font Imports SolidBrush = Bytescout.PDF.SolidBrush Module Program #Region "Declarations" Private Enum PageNoStyle TopLeft TopRight BottomLeft BottomRight End Enum #End Region Sub Main() Try Using doc As Document = New Document() ' Add registration keys doc.RegistrationName = "demo" doc.RegistrationKey = "demo" ' Load document doc.Load("sample.pdf") ' Write template in each pages For i As Integer = 0 To doc.Pages.Count - 1 Dim currentPage As Page = doc.Pages(i) _AddPageNo(currentPage, "Page #" & (i + 1), PageNoStyle.BottomRight) Next ' Save output file doc.Save("result.pdf") End Using ' Open output file Process.Start("result.pdf") Catch ex As Exception Console.WriteLine(ex.Message) Console.WriteLine("Press enter key to exit...") Console.ReadLine() End Try End Sub ''' <summary> ''' Add Page No ''' </summary> Private Sub _AddPageNo(ByVal currentPage As Page, ByVal pageNoText As String, ByVal pageNoStyle As PageNoStyle) Dim float_left As Single = 10 Dim float_top As Single = 10 Select Case pageNoStyle Case PageNoStyle.TopRight float_left = currentPage.Width - 60 Case PageNoStyle.BottomLeft float_top = currentPage.Height - 20 Case PageNoStyle.BottomRight float_top = currentPage.Height - 20 float_left = currentPage.Width - 60 Case Else End Select ' Draw/Write page no currentPage.Canvas.DrawString( pageNoText, New Font(StandardFonts.CourierBold, 12), New SolidBrush(), float_left, float_top) End Sub End Module

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium Suite 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 Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next