Code Samples - Neevia docCreator

Example 7: Convert an URL / HTML file into PDF - 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
35
36
37
   Dim IE As Object : IE = CreateObject("InternetExplorer.Application")
   IE.Visible = True

   Dim DC As Object : DC = CreateObject("Neevia.docCreator")

   IE.navigate2("http:\\www.neevia.com")
   DC.doSleep(100)

   While (IE.ReadyState <> 4) Or (IE.Busy)
     DC.doSleep(100)
   End While

   DC.setParameter("documentOutputFormat", "PDF")
   DC.setParameter("documentOutputName", "testURL_VBNET")
   DC.setParameter("documentOutputFolder", "c:\users\public\")

   Dim RVal As Integer = DC.startPrinting
   If (RVal <> 0) Then MsgBox("Error while creating the virtual printer!!!")

   Dim defPrinter As String = DC.getDefaultPrinter
   DC.setDefaultPrinter(DC.newPrinterName)

   IE.ExecWB(6, 2)

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

   IE.Quit()

   DC.setDefaultPrinter(defPrinter)
   RVal = DC.stopPrinting
   If (RVal <> 0) Then MsgBox("Error while deleting the virtual printer!!!")

   IE = Nothing
   DC = Nothing

   MsgBox("Done Converting !!!")