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 #12105 - Simple Web Page Conversion with WebGrabber 2009
activePDF KB #12105 - Simple Web Page Conversion with WebGrabber 2009
Information: Example Printer Version | Return to Search
Simple Web Page Conversion with WebGrabber 2009
 
Product Version Code Samples    
WebGrabber
4.0
2009
VBS
C#
ASP
CF
 
Description
 
The following ColdFusion example demonstrates activePDF WebGrabber's basic page grabbing functionality.

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:
  • WGSample_2009.cfc - Code detail provided below.
Click here to download this example (includes required file):


<!--- Get local path as varPath --->
<CFSET varPath = ExpandPath(".")>

<!--- Define Variables --->
<!--- Filename of output PDF --->
<CFSET varOutputName = "WG_2009_Sample.pdf">

<!--- URL Format: "http://www.activepdf.com" or "file://folder/file.htm" --->
<CFSET varURL = "http://www.google.com">

<!--- For local machine use these defaults --->
<CFSET varIP = "127.0.0.1">
<CFSET varPort = 64320>
<CFSET varTimeout = 60>

<!--- Instantiate the Object --->
<CFOBJECT ACTION="Create" TYPE="COM" CLASS=APWebGrabber.Object NAME="WG">

<!--- Turn on Debugging --->
<CFSET WG.Debug = True>

<!--- Set activePDF properties (previously Server properties) --->
<CFSET WG.OutputDirectory = varPath>
<CFSET WG.NewDocumentName = varOutputName<

<!--- Specify the URL to convert --->
<CFSET WG.URL = varURL>

<!--- Start the conversion process --->
<CFSET varReturn = WG.DoPrint(varIP, varPort)>
<CFIF varReturn lt 0 OR varReturn gt 0>
<CFOUTPUT>#ERROR("DoPrint")#</CFOUTPUT>
</CFIF>

<!--- Wait for conversion results --->
<CFSET varReturn = WG.Wait(varIP, varPort, varTimeout, "")>
<CFIF varReturn lt 19 OR varReturn gt 19>
<CFOUTPUT>#Error("Wait")#</CFOUTPUT>
</CFIF>

<!--- Run WG CleanUp --->
<CFSET WG.Cleanup(varIP, varPort)>

<!--- Successful conversion --->
<CFOUTPUT>Success!</CFOUTPUT>

<!--- Clear Objects --->
<CFSET ReleaseComObject(WG)>

<!--- Error Handling --->
<CFFUNCTION name="Error">
<CFARGUMENT name="Method" required="Yes">
<CFOUTPUT>'#method#' failed with a '#varReturn#'<br><a href='http://www.activepdf.com/support/knowledgebase/viewKb.cfm?id=12108&tk=000'>WebGrabber Return Codes KB Article</a></CFOUTPUT>
<CFSET ReleaseCOMObject(WG)>
<CFABORT>
</CFFUNCTION>
 
Last Updated 2009-08-30 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