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. Want to add header and footer with pdf sdk in your VB.NET app? ByteScout Premium Suite is designed for it. ByteScout Premium Suite is the set that includes 12 SDK products from ByteScout including tools and components for PDF, barcodes, spreadsheets, screen video recording.
These VB.NET code samples for VB.NET guide developers to speed up coding of the application when using ByteScout Premium Suite. Simply copy and paste in your VB.NET project or application you and then run your app! If you want to use these VB.NET sample examples in one or many applications then they can be used easily.
ByteScout Premium 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)
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
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
Get Your API Key
Explore Web API Docs
Explore Web API Samples
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
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: