在导出之后的PDF,利用Document的Pages.Count计算就可以了
给你一个参考代码:
Private Sub DrawPageNumAndSetSecurity(ByVal doc As Document)
Dim textElem As TextElement
Dim btttfooterFont As Font
Dim bpdffooterFont As PdfFont
btttfooterFont = New System.Drawing.Font(My.Resources.Common.PDF_Font, 9, System.Drawing.GraphicsUnit.Point)
bpdffooterFont = doc.AddFont(btttfooterFont)
Dim pageCountOfFooter As Integer = doc.Pages.Count - 1
Dim i As Integer
For i = 0 To pageCountOfFooter
Dim pageFootString = (pageCountOfFooter + 1).ToString()
textElem = New TextElement(620, 570, My.Resources.Common.PAGE_FOOTER_PNUM.ToString() & (i + 1).ToString() & My.Resources.Common.PAGE_FOOTER_PNUM_INDEX.ToString() & pageFootString, bpdffooterFont)
doc.Pages(i).AddElement(textElem)
SetPagesSecurity(doc.Pages(i))
Next
End Sub