Neevia Technology Sites:   www.neevia.com  |  docuPub.com  |  www.neeviaPDF.com
:: Home :: Products :: Technical Support :: About Us :: Contact Us
Technical support > Neevia docCreator code samples
Example 1: How to create a simple PDF file from VB.NET  Print Example 


    Private Sub prn_PrintPage(ByVal sender As System.Object, _
                              ByVal e As System.Drawing.Printing.PrintPageEventArgs)

        e.Graphics.DrawString("Hello from VB.NET", New Font("Arial", 60, FontStyle.Regular), _
                              Brushes.Blue, 100, 100)

    End Sub

    Private Sub PrintTest()
        Dim DC As Object = CreateObject("Neevia.docCreator")

        DC.setParameter("DocumentOutputFormat", "PDF")
        DC.setParameter("DocumentOutputName", "testVBNET")
        DC.setParameter("DocumentOutputFolder", "d:\")

        Dim prn As New System.Drawing.Printing.PrintDocument
        AddHandler prn.PrintPage, AddressOf prn_PrintPage
        prn.PrinterSettings.PrinterName = "Neevia docCreator"

        Dim tempFile As String = DC.getParameter("TempDir") + DC.GUID + ".ps"

        prn.PrinterSettings.PrintFileName = tempFile
        prn.PrinterSettings.PrintToFile = True

        prn.Print()

        DC.setInputDocument(tempFile)

        Dim RVal As Integer = DC.create()
        DC.fileDelete(tempFile)

        prn = Nothing
        DC = Nothing

        If (RVal <> 0) Then
            MsgBox("Error while creating document!!!")
        Else
            MsgBox("Done !!!")
        End If
    End Sub



Copyright © 1999-2016 Neevia Technology. All Rights Reserved. Home | Products | Technical Support | About Us | Contact Us