ActivePDF
Shopping Cart My Account Help Contact Us
Request a Call
Search
Products Solutions Support Downloads Corporate
Submit an Issue
Knowledge Base
Server Product Support
Examples & How-Tos
Support Options
Support Policies
Annual Subscription
Extensions
Documentation
Resource Links
   
 
 
 
 

HomeSupportKnowledge Base
 
activePDF KB #10543 - Simple Test using the Native Engine
activePDF KB #10543 - Simple Test using the Native Engine
Information: Example Printer Version | Return to Search
Simple Test using the Native Engine
 
Product Version Code Samples    
WebGrabber
3.5.2
VBS
VB.NET
C#
ASP
CF
PHP
 
Description
 
The following VBScript example demonstrates activePDF WebGrabber's basic page grabbing functionality using the Native Engine. Refer to KB #10544 to see this example using the IE Engine.

NOTE: This example is available in other codes. You may select from the Code Sample list above to display the download link for the example in the language appropriate for your environment.

This file is required:
  • BasicNative.vbs - Code detail provided below.
Click here to download this example (includes required file):
' Get local path as varPath
arrayScr = Split(WScript.ScriptFullName, "\", -1, 1)
For i = 0 to UBound(arrayScr) - 1
   varPath = varPath & arrayScr(i) & "\"
Next

' Define Variables
    ' EngineToUse (1=IE, 0=Native)
    varEngine = 0

    ' URL format: "http://www.activepdf.com" or "file://folder/file.htm"
    varURL = "http://www.activepdf.com/support/knowledgebase/view.cfm?kb=10543&code=vbs"
    
    ' Timeout for various calls
    varTimeout = 60
   
    ' For local machine use these defaults
    varIP = "127.0.0.1"
    varPort = "64320"

' Instantiate Objects
Set WG = CreateObject("APWebGrabber.Object")
Set APS = CreateObject("APServer.Object")

' Set activePDF Server properties
APS.OutputDirectory varPath
APS.PDFTimeout = varTimeout

' Must call before DoPrint to pass server settings to WG
WG.Prt2DiskSettings = APS.ToString()

' Set WebGrabber properties
WG.EngineToUse = varEngine
WG.URL = varURL
WG.TimeOut = varTimeout
WG.PrinterTimeout = varTimeout
WG.PrintBackgroundColors = 1
WG.TopBottomMargin = 150
WG.LeftRightMargin = 150


' Start the conversion process
varReturn = WG.DoPrint(varIP, varPort)
If varReturn <> 0 Then Error("DoPrint") End If

' Wait for conversion result
varReturn = WG.Wait(varIP, varPort, varTimeout, "")
If varReturn <> 19 Then Error("Wait") End If

' Run WG CleanUp
WG.Cleanup varIP, varPort

' Clear Objects
Set WG = Nothing
Set APS = Nothing

' Error Handling
Sub Error(Method)
    Msgbox "'" & Method & "' failed with a '" & varReturn & _
            "'" & VBCRLF & "KB article on Return codes:" & VBCRLF & _
            "http://www.activepdf.com/support/knowledgebase/viewKb.cfm?id=10033&tk=ts"
    Set WG = Nothing
    Set APS = Nothing
    Wscript.Quit
End Sub
 
Related Articles

  • 10545 - EngineToUse
    Instructs WebGrabber to use the 10576Native Engine or 10577IE Engine for page rendering.


  • 10025 - Adding Page Breaks
    activePDF WebGrabber gives you the ability to utilize custom page breaks to control your PDF output. The steps depend on the specified 10545EngineToUse:...


  • 10026 - Preserve background colors during conversion
    The steps for preserving background colors depend on the rendering engine specified by the EngineToUse property. ...


  • 10071 - Images have discolored background in output PDF
    Images containing transparencies have a pink or discolored background in the output PDF using the Native Engine. The IE Engine con...


 
Keywords
 
webgrabber, wg, simple, basic, test, example, code, run, install, won't, doesn't, work, IE, engine, native, default, php, hypertext, preprocessor, asp, cfm, cf, coldfusion, cold, fusion, VBS, VBScript, vb, script, example
 
Last Updated 2008-01-01 Printer Version | Return to Search
 
Knowledge Base Article Feedback*
*KB article feedback ONLY (submit support issues here)
Quality of this article?
  Poor Excellent 
1 2 3 4 5 6 7 8 9 10
Is this article helpful? Yes       No       Maybe
Comments (Optional)
Email Address (Optional)
Please enter the word "PDF"
(without quotes)
 
The information in this article is for the use of activePDF Customers and Evaluation Users Only. No part of this document may be transmitted or reproduced without the express written consent of activePDF.

Copyright © 2005, activePDF, Inc. All Rights Reserved
2003 activePDF Site Map Feedback Privacy Policy Legal