Add Page Numbers to PDF

S

Swami

I am looking to progammatically add page numbers to a PDF using VBA. I create
a multi-page PDF using various Excel reports. The PDF then needs to be
numbered sequentially. I have been able to research and find code to add a
watermark to the PDF, but, no luck on page numbering. I am using Excel 2007
and Acrobat 9.

Code Example:
Sub WatermarkPDF()

Dim bolResult As Boolean
Dim pdfDoc1 As AcroPDDoc
Dim jsObj As Object

Set pdfDoc1 = CreateObject("AcroExch.PDDoc")

If pdfDoc1.Open("C:\Test\Ranges\Reports\Custom_Merged.pdf") Then
Set jsObj = pdfDoc1.GetJSObject
jsObj.addWatermarkFromText ("Confidential")
End If

savepgnumfile = pdfDoc1.Save(1,
"C:\Test\Ranges\Reports\Custom_Merged_Watermark.pdf")

pdfDoc1.Close

Set jsObj = Nothing
Set pdfDoc1 = Nothing

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top