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