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

Sub HelloWorld()

    Dim DPSDK : Set DPSDK = CreateObject("docuPrinter.SDK")
    DPSDK.BackupSettings
    Dim printerFound : printerFound = False
   
    Dim objPrinter

    For Each objPrinter In Printers

     If objPrinter.DeviceName = "docuPrinter" Then

        printerFound = True
        Set Printer = objPrinter
        Exit For

     End If

    Next

    If Not printerFound Then

      MsgBox "Printer not found!!!"
      Exit Sub

    End If

    DPSDK.DocumentOutputFormat = "PDF"
    DPSDK.DocumentOutputName = "demoVB"
    DPSDK.DocumentOutputFolder = "c:\"   
 
    DPSDK.HideSaveAsWindow = true
    DPSDK.DefaultAction=1
    DPSDK.ApplySettings
 
    Printer.FontName = "Times New Roman"
    Printer.FontSize = 48
    Printer.Print "Hello from Visual Basic!!!"

    Printer.EndDoc

    Dim RVal : RVal = DPSDK.Create ' Create output document
    DPSDK.RestoreSettings
    Set DPSDK = Nothing

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

  End Sub



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