ByteScout PDF SDK - VBScript and VB6 - Add Page Numbers in PDF - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

ByteScout PDF SDK – VBScript and VB6 – Add Page Numbers in PDF

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF SDK – VBScript and VB6 – Add Page Numbers in PDF

How to add page numbers in PDF in VBScript and VB6 using ByteScout PDF SDK

Tutorial on how to add page numbers in PDF in VBScript and VB6

Sample source code below will show you how to cope with a difficult task like add page numbers in PDF in VBScript and VB6. Want to add page numbers in PDF in your VBScript and VB6 app? ByteScout PDF SDK is designed for it. ByteScout PDF SDK is the component to help programmers in generating new pdf files, modifying and updating existing pdf documents or pdf forms. Provides support for auto-filling pdf forms, adding text with adjustable font, style, size, font family, new form fields, vector and raster drawings.

This code snippet below for ByteScout PDF SDK works best when you need to quickly add page numbers in PDF in your VBScript and VB6 application. Follow the instructions from the scratch to work and copy the VBScript and VB6 code. Enjoy writing a code with ready-to-use sample VBScript and VB6 codes.

ByteScout PDF SDK free trial version is available on our website. VBScript and VB6 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)

PageNumbers.vbs
      
' This example demonstrates how to add page numbers (labels) visible in the page thumbnails panel of PDF viewer. ' Create Bytescout.PDF.Document object Set pdfDocument = CreateObject("Bytescout.PDF.Document") pdfDocument.RegistrationName = "demo" pdfDocument.RegistrationKey = "demo" Set comHelpers = pdfDocument.ComHelpers ' Add twenty pages For i = 0 To 19 pdfDocument.Pages.Add(comHelpers.CreatePage(comHelpers.PAPERFORMAT_A4)) Next ' First five pages will have roman numbers I, II, III, ... Set pageLabel = comHelpers.CreatePageLabel(0, comHelpers.PAGENUMBERINGSTYLE_UPPERCASEROMAN) pdfDocument.PageLabels.Add(pageLabel) ' Next five pages will have arabic numbers 6, 7, 8, ... pageLabel.Style = comHelpers.PAGENUMBERINGSTYLE_DECIMALARABIC pageLabel.StartPortion = 6 pageLabel.FirstPageIndex = 5 pdfDocument.PageLabels.Add(pageLabel) ' Next five pages will have complex page numbers with prefix A-11, A-12, A-13, ... pageLabel.Style = comHelpers.PAGENUMBERINGSTYLE_DECIMALARABIC pageLabel.Prefix = "A-" pageLabel.StartPortion = 11 pageLabel.FirstPageIndex = 10 pdfDocument.PageLabels.Add(pageLabel) ' Next five pages will use letters as page numbers P, Q, R, ... pageLabel.Prefix = "" pageLabel.Style = comHelpers.PAGENUMBERINGSTYLE_UPPERCASELETTERS pageLabel.StartPortion = 16 pageLabel.FirstPageIndex = 15 pdfDocument.PageLabels.Add(pageLabel) ' Force PDF viewer to show page thumbnails panel on start up pdfDocument.PageMode = comHelpers.PAGEMODE_THUMBNAIL ' Save document to file pdfDocument.Save("result.pdf") ' Open document in default PDF viewer app Set shell = CreateObject("WScript.Shell") shell.Run "result.pdf", 1, false

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