Code Samples - Neevia docCreator

Example 7: Convert an URL / HTML file into PDF - Visual Basic 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
38
39
    Dim IE : Set IE = CreateObject("InternetExplorer.Application")
    IE.Visible=true

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

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

    While (IE.ReadyState<>4) or (IE.Busy)
      DC.doSleep(100)
    Wend

    DC.setParameter "DocumentOutputFormat", "PDF"
    DC.setParameter "DocumentOutputName", "testURL_VB"
    DC.setParameter "DocumentOutputFolder", "c:\users\public\"

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

    Dim defPrinter : defPrinter = DC.getDefaultPrinter
    DC.setDefaultPrinter DC.newPrinterName 

    IE.ExecWB 6,2

    RVal = DC.create  
    If (RVal <> 0) Then 
      MsgBox "Error while creating document!!!"& Rval
    else
      MsgBox "Done converting !!!"
    End If

    IE.Quit

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

    Set IE=Nothing
    Set DC=Nothing