I need to insert a page number in a pdf file.
With this code I can to insert page number in bottom left position but I don't understant how to insert in bottom right.
I can't figure out how to transform the value of PDFPage.Size.Height and PDFPage.Size.Width in coordinate to draw text or image in PDF page.
Can you help me ?
Thanks in advance....
Code: Select all
Dim stream As System.IO.Stream = System.IO.File.Open(PDFName, System.IO.FileMode.Open)
Dim document As PdfDocument = PdfDocumentController.OpenDocument(stream)
For p As Integer = 0 To document.Pages.Count - 1
Using g As PdfGraphics = PdfGraphics.FromPage(document.Pages(p))
Dim font As New Font("Arial", 12)
Dim brush As New PdfBrush(Color.Black)
Dim PDFPage As Vintasoft.Imaging.Pdf.Tree.PdfPage = document.Pages(p)
Dim X As Single = PDFPage.Size.Height
Dim Y As Single = PDFPage.Size.Width
Dim Location As New System.Drawing.Point(1, 1)
g.DrawString(p.ToString("00000"), font, brush, Location)
End Using
Next
document.SaveChanges()
PdfDocumentController.CloseDocument(document)