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 Visual Basic  Print Example 


   Dim DC: Set DC = CreateObject("Neevia.docCreator")

   Dim RVal: RVal = DC.startPrinting
   If (RVal <> 0) Then
      MsgBox "Error while calling StartPrinting method!!!"
      Exit Sub
   End If

   Dim printerFound: printerFound = False

   Dim objPrinter
   For Each objPrinter In Printers
     If objPrinter.DeviceName = DC.NewPrinterName Then
        printerFound = True
        Set Printer = objPrinter
        Exit For
     End If
   Next

   If Not printerFound Then
     MsgBox "Printer not found!!!"
     DC.stopPrinting
     Exit Sub
   End If

   DC.setParameter "DocumentOutputFormat", "PDF"
   DC.setParameter "DocumentOutputName", "testVB"
   DC.setParameter "DocumentOutputFolder", "d:\"

   Printer.FontName = "Times New Roman"
   Printer.FontSize = 48
   Printer.Print "Hello from Visual Basic!!!"
   Printer.EndDoc

   RVal = DC.Create ' Create output document
   If (RVal <> 0) Then MsgBox "Error while creating document!!!"

   RVal = DC.stopPrinting
   Set DC = Nothing

   If (RVal <> 0) Then
     MsgBox "Error while calling StopPrinting method!!!"
   Else
     MsgBox "Done!!!"
   End If



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