EasyBulletList.vb
''
'' This code is part of Document Solutions for PDF .NET demos.
'' Copyright (c) MESCIUS inc. All rights reserved.
''
Imports System.IO
Imports System.Drawing
Imports GrapeCity.Documents.Pdf
Imports GrapeCity.Documents.Text
Imports GrapeCity.Documents.Drawing
Imports GCTEXT = GrapeCity.Documents.Text
Imports GCDRAW = GrapeCity.Documents.Drawing

Public Class EasyBulletList
    Public Function CreatePDF(ByVal stream As Stream) As Integer
        Const FontSize As Integer = 12
        Dim doc = New GcPdfDocument()
        Dim page = doc.Pages.Add()
        Dim g = page.Graphics
        Dim tl = g.CreateTextLayout()

        Dim img = GCDRAW.Image.FromFile(Path.Combine("Resources", "ImagesBis", "2020-website-gcdocs-headers_tall.png"))
        Dim rc = page.Bounds
        rc.Height *= 0.65F
        g.DrawImage(img, rc, Nothing, ImageAlign.StretchImage)

        Dim ip = New PointF(48, 72)

        Dim font = GCTEXT.Font.FromFile(Path.Combine("Resources", "Fonts", "NotoSans-Regular.ttf"))
        Dim tfCap = New TextFormat() With {.Font = font, .FontSize = FontSize * 1.6F, .ForeColor = Color.White}
        Dim tf = New TextFormat() With {.Font = font, .FontSize = FontSize, .ForeColor = Color.White}
        tl.MaxWidth = 72 * 6

        ' Header:
        tl.AppendLine("Feature-Rich C# .NET PDF API Library for Total Document Control", tfCap)
        tl.AppendLine(tfCap)
        tl.AppendLine("Document Solutions for PDF (DsPdf, previously GcPdf) allows you to generate documents with speed, memory efficiency with no dependencies.", tf)
        tl.AppendLine(tf)
        g.DrawTextLayout(tl, ip)

        ' Bullet list:
        ip.Y += tl.ContentHeight
        tl.Clear()
        Const bullet As String = ChrW(&H2022) & ChrW(&H2003)
        tl.FirstLineIndent = -g.MeasureString(bullet, tf).Width
        tl.ParagraphSpacing += 4

        tl.Append(bullet, tf)
        tl.AppendLine("Generate, load, edit, and save PDF documents in C# or VB", tf)
        tl.Append(bullet, tf)
        tl.AppendLine("Support multiple languages with full text, paragraph formatting, and fonts", tf)
        tl.Append(bullet, tf)
        tl.AppendLine("Mark and redact sensitive content from PDFs", tf)
        tl.Append(bullet, tf)
        tl.AppendLine("View or embed audio and video content in PDFs", tf)
        tl.Append(bullet, tf)
        tl.AppendLine("Multiple options for optimizing PDF documents", tf)
        tl.Append(bullet, tf)
        tl.AppendLine("Support hundreds of PDF features", tf)
        tl.Append(bullet, tf)
        tl.AppendLine("All features are fully supported on Windows, macOS, and Linux", tf)
        tl.Append(bullet, tf)
        tl.AppendLine("Includes a JavaScript PDF Viewer to view and edit PDF documents", tf)
        g.DrawTextLayout(tl, ip)

        doc.Save(stream)
        Return doc.Pages.Count
    End Function
End Class