ByteScout PDF Suite - VBScript - Add page numbers in pdf with pdf sdk - ByteScout

ByteScout PDF Suite – VBScript – Add page numbers in pdf with pdf sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF Suite – VBScript – Add page numbers in pdf with pdf sdk

How to add page numbers in pdf with pdf sdk in VBScript with ByteScout PDF Suite

How to write a robust code in VBScript to add page numbers in pdf with pdf sdk with this step-by-step tutorial

ByteScout simple and easy to understand tutorials are planned to describe the code for both VBScript beginners and advanced programmers. 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. It can be applied to add page numbers in pdf with pdf sdk using VBScript.

The SDK samples given below describe how to quickly make your application do add page numbers in pdf with pdf sdk in VBScript with the help of ByteScout PDF Suite. Just copy and paste the code into your VBScript application’s code and follow the instructions. Applying VBScript 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.

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