Code Samples - Neevia docuPrinter SDK

Example 1: How to create a simple PDF file - VB.NET Copy 

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
   Private Sub Button1_Click(ByVal sender As System.Object, _
                             ByVal e As System.EventArgs) Handles Button1.Click

       Dim prn As New System.Windows.Forms.Printing.SimplePrintDocument

       Dim DPSDK As Object = CreateObject("docuPrinter.SDK")

       prn.FontName = "Times New Roman"
       prn.FontSize = 48
       prn.DrawText(0, 0, "Hello from VB.NET !!!")

       DPSDK.DocumentOutputFormat = "PDF"
       DPSDK.DocumentOutputFolder = "c:\users\public\"
       DPSDK.DocumentOutputName = "testVBNET"

       DPSDK.HideSaveAsWindow = True
       DPSDK.DefaultAction = 1
       DPSDK.ApplySettings()

       prn.PrinterSettings.PrinterName = "docuPrinter"
       prn.Print()

       Dim RVal As Long = DPSDK.Create()

       prn = Nothing
       DPSDK = Nothing

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

   End Sub