WebGrabber WBE 2010

Converting a URL behind a proxy

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/14/19  -->

<%
Dim strPath, intDoPrint

strPath = Server.MapPath(".") & "\"

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

' Proxy settings in order to access external URL's
oWG.ProxyPortHTTP = "80"
oWG.ProxyServerHTTP = "192.168.1.5"
oWG.ProxyServerUserName = "john.doe"
oWG.ProxyServerPassword = "xxxxxxxx"

' 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

' Convert HTML fields to PDF fields
oWG.PreserveButtons = false
oWG.PreserveCheckBoxes = false
oWG.PreserveDropDowns = false
oWG.PreserveRadioButtons = false
oWG.PreserveTextBoxes = false

' Convert links
oWG.PreserveLinks = true


' Enable flash conversion
oWG.EmbedFlash = true

' PDF output location and filename
oWG.OutputDirectory = strPath
oWG.NewDocumentName = "proxy.pdf"

' HTML to convert
' Examples:
' http://domain.com/path/file.aspx
' c:\folder\file.html
oWG.URL = "http://examples.activepdf.com/system/files/49/original/wg.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
Response.Write "Done!"

' Error Handling
Sub ErrorHandler(method, outputCode)
  Response.Write("Error in " & method & ": " & outputCode)
End Sub
%>

Copyright © 2019 ActivePDF, Inc