''' <summary>
''' Adds text (not transparent and transparent, not rotated and rotated) to a PDF page.
''' </summary>
''' <param name="pdfFilename">The PDF filename.</param>
Public Shared Sub AddTextToPdfPage(pdfFilename As String)
' create new PDF document
Using document As New Vintasoft.Imaging.Pdf.PdfDocument(pdfFilename, Vintasoft.Imaging.Pdf.PdfFormat.Pdf_16)
' add empty page (A4 size)
Dim page As Vintasoft.Imaging.Pdf.Tree.PdfPage = document.Pages.Add(Vintasoft.Imaging.PaperSizeKind.A4)
' get PdfGraphics for PDF page
Using g As Vintasoft.Imaging.Pdf.Drawing.PdfGraphics = page.GetGraphics()
' create a font that should be used for drawing a text
Dim font As Vintasoft.Imaging.Pdf.Tree.Fonts.PdfFont = document.FontManager.GetStandardFont(Vintasoft.Imaging.Pdf.Tree.Fonts.PdfStandardFontType.TimesRoman)
' draw NOT transparent and NOT rotated text on PDF page
Dim redBrush As New Vintasoft.Imaging.Pdf.Drawing.PdfBrush(System.Drawing.Color.Red)
g.DrawString("Not transparent text", font, 30, redBrush, New System.Drawing.PointF(50, 250))
' draw transparent and NOT rotated text on PDF page
Dim transparentRedBrush As New Vintasoft.Imaging.Pdf.Drawing.PdfBrush(System.Drawing.Color.FromArgb(64, 255, 0, 0))
g.DrawString("Transparent text", font, 30, transparentRedBrush, New System.Drawing.PointF(50, 350))
' draw NOT transparent and rotated text on PDF page
Dim blueBrush As New Vintasoft.Imaging.Pdf.Drawing.PdfBrush(System.Drawing.Color.Blue)
g.SaveGraphicsState()
Dim m As New Vintasoft.Imaging.AffineMatrix()
' rotate at 30 degress around (X=50, Y=450) point
m.RotateAt(30, 50, 450)
g.MultiplyTransform(m)
g.DrawString("Rotated text", font, 30, blueBrush, New System.Drawing.PointF(50, 450))
g.RestoreGraphicsState()
End Using
' save changes in PDF document
document.SaveChanges()
End Using
End Sub