Public Class Form1

    Private Sub btnHelloWorld_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHelloWorld.Click

        ' Make sure that you have registered (regsvr32) the ActiveX
        ' edition of PDF Library and added it as a reference
        ' to this project (Project > Add Reference > COM)

        Dim PDFlib As PDFlibAX.PDFlibrary
        Dim ClassName = "PDFlibAX.PDFlibrary"
        Dim Result

        PDFlib = CreateObject(ClassName)

        ' This function sets the origin
        ' for the co-ordinates used by
        ' the drawing functions.

        PDFlib.SetOrigin(1)

        ' The DrawText function lets you
        ' draw text onto a page.

        PDFlib.DrawText(100, 100, "Hello Visual Basic! This text has been drawn using the DrawText function.")
        PDFlib.DrawHTMLText(100, 125, 400, "<b>PDF Library Version:</b> " + PDFlib.LibraryVersion())

        ' The DrawBox function lets you
        ' draw rectangular shapes.

        PDFlib.DrawBox(50, 50, 500, 150, 0)

        ' Save the new file to disk.

        If PDFlib.SaveToFile("Helloworld.pdf") = 1 Then
            lblStatus.Text = "Success! PDF file saved to current folder."
        Else
            lblStatus.Text = "Error, the file was not saved."
        End If

        PDFlib = Nothing
    End Sub

End Class
