WebGrabber WBE 2010

HTMLTextToFile

Example code is for an older version of WebGrabber, newer code is available.
' Copyright (c) 2019 ActivePDF, Inc.
' ActivePDF WebGrabber WBE 2010
' Example generated 12/15/19 

Dim FSO, intDoPrint

' Instantiate Object
Set oWG = CreateObject("APWebGrabber.Object")

' Enable extra logging - c:\windows\activepdf\logs
' Logging should be disabled during production
oWG.Debug = true

' Fast web view
oWG.LinearizeDocument = true

' Time to wait for conversion to complete (in seconds)
oWG.Timeout = 30

' Margins (Top, Bottom, Left, Right) 1.0 = 1"
oWG.SetMargins 0.75, 0.75, 0.75, 0.75

' 0 = Portrait, 1 = Landscape
oWG.Orientation = 0

' Save the HTML text into a file before conversion
oWG.HTMLTextToFile = true

' HTML to convert
oWG.CreateFromHTMLText = "<html><body>"
oWG.CreateFromHTMLText = "Hello World!"
oWG.CreateFromHTMLText = "</body></html>"

' Perform the HTML to PDF conversion
intDoPrint = oWG.DoPrint("127.0.0.1", 58585)
If intDoPrint <> 0 Then
  ErrorHandler "DoPrint", intDoPrint
End If

' Cleans up all internal string variables used during conversion
' By default variables are deleted 3 minutes after the conversion
oWG.CleanUp "127.0.0.1", 58585

' Release Object
Set oWG = Nothing

' Process Complete
Wscript.Echo("Done!")

' Error Handling
Sub ErrorHandler(method, outputCode)
  Wscript.Echo("Error in " & method & ": " & outputCode)
End Sub

Copyright © 2019 ActivePDF, Inc