How Do I Add Page Numbers To PDF Document?

There are a couple of ways to add page numbers to PDF files generated from DominoPDF.

1. Use HTMLHeader or HTMLFooter settings.

To add page numbering to a PDF you can control it via the settings option in the DoPDF() method.

Call v.DoPDF(sURL, sPDF, “HTMLFooter=Page {$PAGE} of {$PAGECOUNT ;BottomMargin=20”)

The HTMLFooter= option controls the content of the footer with reserved tags for {$PAGE} and {$PAGECOUNT} and the BottomMargin= option controls the height of the footer area so the text is displayed correctly (by default in MM unless UseInches=True is specified).

2. Use DomPDFPages() and DomPDFAddText() methods.

If you want to add page numbers to a PDF after it has been created or add page numbers to any PDF (not necessarily created with DominoPDF) you can use a combination of the DomPDFPages() and DomPDFAddText() methods.

DomPDFPages() will get the page count of any PDF.

iPage = v.DomPDFPages(sPDF)

DomPDFAddText() can “stamp” text on any PDF.

for t = 1 to iPage
Call v.DomPDFAddText(sPDF, “Page ” & CStr(t), CStr(t), 10, 10, 50, 0, 9)
next t

Comments are closed.