Code:
Me.Cursor = Cursors.WaitCursor
Dim cPDF As New vbPDF
With cPDF
.ReportFileName = "c:\Fonts.pdf"
.ScaleMode = pdf.ScaleMode.Inch
.PaperSize = pdf.PaperSize._8_5x11
.Author = "Ken Bradford"
.Title = "Example 4 - Fonts"
If Not .CreatePDFFile() Then
Me.Cursor = Cursors.Default
Exit Sub
End If
'Load all fonts.
.LoadFont("Arial", pdf.FontName.Arial, pdf.FontStyle.Regular)
.LoadFont("ArialBold", pdf.FontName.Arial, pdf.FontStyle.Bold)
.LoadFont("ArialItalic", pdf.FontName.Arial, pdf.FontStyle.Italic)
.LoadFont("ArialBoldItalic", pdf.FontName.Arial, pdf.FontStyle.BoldItalic)
.LoadFont("Comic", pdf.FontName.ComicSansMS, pdf.FontStyle.Regular)
.LoadFont("ComicBold", pdf.FontName.ComicSansMS, pdf.FontStyle.Bold)
.LoadFont("ComicItalic", pdf.FontName.ComicSansMS, pdf.FontStyle.Italic)
.LoadFont("ComicBoldItalic", pdf.FontName.ComicSansMS, pdf.FontStyle.BoldItalic)
.LoadFont("Courier", pdf.FontName.CourierNew, pdf.FontStyle.Regular)
.LoadFont("CourierBold", pdf.FontName.CourierNew, pdf.FontStyle.Bold)
.LoadFont("CourierItalic", pdf.FontName.CourierNew, pdf.FontStyle.Italic)
.LoadFont("CourierBoldItalic", pdf.FontName.CourierNew, pdf.FontStyle.BoldItalic)
.LoadFont("LucidaConsole", pdf.FontName.LucidaConsole, pdf.FontStyle.Regular)
.LoadFont("LucidaConsoleBold", pdf.FontName.LucidaConsole, pdf.FontStyle.Bold)
.LoadFont("LucidaConsoleItalic", pdf.FontName.LucidaConsole, pdf.FontStyle.Italic)
.LoadFont("LucidaConsoleBoldItalic", pdf.FontName.LucidaConsole, pdf.FontStyle.BoldItalic)
.LoadFont("PalatinoLinotype", pdf.FontName.PalatinoLinotype, pdf.FontStyle.Regular)
.LoadFont("PalatinoLinotypeBold", pdf.FontName.PalatinoLinotype, pdf.FontStyle.Bold)
.LoadFont("PalatinoLinotypeItalic", pdf.FontName.PalatinoLinotype, pdf.FontStyle.Italic)
.LoadFont("PalatinoLinotypeBoldItalic", pdf.FontName.PalatinoLinotype, pdf.FontStyle.BoldItalic)
.LoadFont("SansSerif", pdf.FontName.MicrosoftSansSerif, pdf.FontStyle.Regular)
.LoadFont("SansSerifBold", pdf.FontName.MicrosoftSansSerif, pdf.FontStyle.Bold)
.LoadFont("SansSerifItalic", pdf.FontName.MicrosoftSansSerif, pdf.FontStyle.Italic)
.LoadFont("SansSerifBoldItalic", pdf.FontName.MicrosoftSansSerif, pdf.FontStyle.BoldItalic)
.LoadFont("TimesNewRoman", pdf.FontName.TimesNewRoman, pdf.FontStyle.Regular)
.LoadFont("TimesNewRomanBold", pdf.FontName.TimesNewRoman, pdf.FontStyle.Bold)
.LoadFont("TimesNewRomanItalic", pdf.FontName.TimesNewRoman, pdf.FontStyle.Italic)
.LoadFont("TimesNewRomanBoldItalic", pdf.FontName.TimesNewRoman, pdf.FontStyle.BoldItalic)
.LoadFont("Verdana", pdf.FontName.Verdana, pdf.FontStyle.Regular)
.LoadFont("VerdanaBold", pdf.FontName.Verdana, pdf.FontStyle.Bold)
.LoadFont("VerdanaItalic", pdf.FontName.Verdana, pdf.FontStyle.Italic)
.LoadFont("VerdanaBoldItalic", pdf.FontName.Verdana, pdf.FontStyle.BoldItalic)
.StartPage()
.DrawText(0.25, 10, "Arial Regular 18", "Arial", 18, pdf.TextAlignment.Left, Color.Blue)
.DrawText(0.25, 9.75, "Arial Bold 18", "ArialBold", 18, pdf.TextAlignment.Left, Color.Blue)
.DrawText(0.25, 9.5, "Arial Italic 18", "ArialItalic", 18, pdf.TextAlignment.Left, Color.Blue)
.DrawText(0.25, 9.25, "Arial Bold Italic 18", "ArialBoldItalic", 18, pdf.TextAlignment.Left, Color.Blue)
.DrawText(0.25, 9, "Comic Regular 18", "Comic", 18, pdf.TextAlignment.Left, Color.Red)
.DrawText(0.25, 8.75, "Comic Bold 18", "ComicBold", 18, pdf.TextAlignment.Left, Color.Red)
.DrawText(0.25, 8.5, "Comic Italic 18", "ComicItalic", 18, pdf.TextAlignment.Left, Color.Red)
.DrawText(0.25, 8.25, "Comic Bold Italic 18", "ComicBoldItalic", 18, pdf.TextAlignment.Left, Color.Red)
.DrawText(0.25, 8, "Courier Regular 18", "Courier", 18, pdf.TextAlignment.Left, Color.Green)
.DrawText(0.25, 7.75, "Courier Bold 18", "CourierBold", 18, pdf.TextAlignment.Left, Color.Green)
.DrawText(0.25, 7.5, "Courier Italic 18", "CourierItalic", 18, pdf.TextAlignment.Left, Color.Green)
.DrawText(0.25, 7.25, "Courier Bold Italic 18", "CourierBoldItalic", 18, pdf.TextAlignment.Left, Color.Green)
.DrawText(0.25, 7, "Lucida Console Regular 18", "LucidaConsole", 18, pdf.TextAlignment.Left, Color.DarkOrange)
.DrawText(0.25, 6.75, "Lucida Console Bold 18", "LucidaConsoleBold", 18, pdf.TextAlignment.Left, Color.DarkOrange)
.DrawText(0.25, 6.5, "Lucida Console Italic 18", "LucidaConsoleItalic", 18, pdf.TextAlignment.Left, Color.DarkOrange)
.DrawText(0.25, 6.25, "Lucida Console Bold Italic 18", "LucidaConsoleBoldItalic", 18, pdf.TextAlignment.Left, Color.DarkOrange)
.DrawText(0.25, 6, "Palatino Linotype Regular 18", "PalatinoLinotype", 18, pdf.TextAlignment.Left, Color.Brown)
.DrawText(0.25, 5.75, "Palatino Linotype Bold 18", "PalatinoLinotypeBold", 18, pdf.TextAlignment.Left, Color.Brown)
.DrawText(0.25, 5.5, "Palatino Linotype Italic 18", "PalatinoLinotypeItalic", 18, pdf.TextAlignment.Left, Color.Brown)
.DrawText(0.25, 5.25, "Palatino Linotype Bold Italic 18", "PalatinoLinotypeBoldItalic", 18, pdf.TextAlignment.Left, Color.Brown)
.DrawText(0.25, 5, "Sans Serif Regular 18", "SansSerif", 18, pdf.TextAlignment.Left, Color.Violet)
.DrawText(0.25, 4.75, "Sans Serif Bold 18", "SansSerifBold", 18, pdf.TextAlignment.Left, Color.Violet)
.DrawText(0.25, 4.5, "Sans Serif Italic 18", "SansSerifItalic", 18, pdf.TextAlignment.Left, Color.Violet)
.DrawText(0.25, 4.25, "Sans Serif Bold Italic 18", "SansSerifBoldItalic", 18, pdf.TextAlignment.Left, Color.Violet)
.DrawText(0.25, 4, "Times New Roman Regular 18", "TimesNewRoman", 18, pdf.TextAlignment.Left, Color.DarkMagenta)
.DrawText(0.25, 3.75, "Times New Roman Bold 18", "TimesNewRomanBold", 18, pdf.TextAlignment.Left, Color.DarkMagenta)
.DrawText(0.25, 3.5, "Times New Roman Italic 18", "TimesNewRomanItalic", 18, pdf.TextAlignment.Left, Color.DarkMagenta)
.DrawText(0.25, 3.25, "Times New Roman Bold Italic 18", "TimesNewRomanBoldItalic", 18, pdf.TextAlignment.Left, Color.DarkMagenta)
.DrawText(0.25, 3, "Verdana Regular 18", "Verdana", 18, pdf.TextAlignment.Left, Color.CornflowerBlue)
.DrawText(0.25, 2.75, "Verdana Bold 18", "VerdanaBold", 18, pdf.TextAlignment.Left, Color.CornflowerBlue)
.DrawText(0.25, 2.5, "Verdana Italic 18", "VerdanaItalic", 18, pdf.TextAlignment.Left, Color.CornflowerBlue)
.DrawText(0.25, 2.25, "Verdana Bold Italic 18", "VerdanaBoldItalic", 18, pdf.TextAlignment.Left, Color.CornflowerBlue)
.EndPage()
.ClosePDFFile()
End With
Try
System.Diagnostics.Process.Start("c:\Fonts.pdf")
Catch ex As Exception
Me.Cursor = Cursors.Default
MessageBox.Show("Unable to display PDF Document '" & "c:\Fonts.pdf" & "'.'" & Environment.NewLine & Environment.NewLine & ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
Me.Cursor = Cursors.Default