ByteScout PDF Suite - VB.NET - Add header and footer with pdf sdk - ByteScout

ByteScout PDF Suite – VB.NET – Add header and footer with pdf sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF Suite – VB.NET – Add header and footer with pdf sdk

How to add header and footer with pdf sdk in VB.NET using ByteScout PDF Suite

How to write a robust code in VB.NET to add header and footer with pdf sdk with this step-by-step tutorial

The sample shows instructions and algorithm of how to add header and footer with pdf sdk and how to make it run in your VB.NET application. ByteScout PDF Suite can add header and footer with pdf sdk. It can be applied from VB.NET. ByteScout PDF Suite is the set that includes 6 SDK products to work with PDF from generating rich PDF reports to extracting data from PDF documents and converting them to HTML. This bundle includes PDF (Generator) SDK, PDF Renderer SDK, PDF Extractor SDK, PDF to HTML SDK, PDF Viewer SDK and PDF Generator SDK for Javascript.

These VB.NET code samples for VB.NET guide developers to speed up coding of the application when using ByteScout PDF Suite. Follow the instructions from scratch to work and copy the VB.NET code. Enjoy writing a code with ready-to-use sample VB.NET codes.

ByteScout PDF Suite free trial version is available on our website. VB.NET and other programming languages are supported.

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 Sub Main() Try Using doc As Document = New Document() doc.RegistrationName = "demo" doc.RegistrationKey = "demo" doc.Load("sample.pdf") ' Prepare simple template (for example, a logo) And draw it on every page ' Create template of specified size Dim headerTemplate As GraphicsTemplate = New GraphicsTemplate(250, 50) headerTemplate.DrawString("Here is a header text", New Font(StandardFonts.CourierBold, 15), New SolidBrush(), 30, 10) Dim footerTemplate As GraphicsTemplate = New GraphicsTemplate(250, 50) footerTemplate.DrawString("Here is the footer text", New Font(StandardFonts.CourierBold, 15), New SolidBrush(), 30, 10) ' Write template in each pages For i As Integer = 0 To doc.Pages.Count - 1 Dim currentPage As Page = doc.Pages(i) currentPage.Canvas.DrawTemplate(headerTemplate, 40, 10) currentPage.Canvas.DrawTemplate(footerTemplate, 350, (currentPage.Height - 40)) 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) End Try Console.WriteLine("Press enter key to exit...") Console.ReadLine() End Sub End Module

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF Suite Home Page

Explore ByteScout PDF Suite Documentation

Explore Samples

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

Explore ByteScout PDF Suite Documentation

Explore Samples

Sign Up for ByteScout PDF Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next