| Product | Version | |||
|
|
NOTE: This example is also available for ColdFusion®. Choose from the Code Sampleslist above to display the download link and information for the script appropriate for you environment.
This example follows these necessary steps:- Create the script to display the button.
- Add the button script to your HTML page.
- Create the script run when the button is clicked.
- button.asp - Script to create Convert to PDF button. (Code detail provided below.)
- index.asp - Sample page containing script. (Code detail provided below.)
- convert.asp - Conversion script run when Convert to PDF is pressed. (Code detail provided below.)
| The script controlling the display of the button. NOTE: This script is designed to exclude the button from the output. <% ' Collect post data for the new session ' Output the form to the screen |
| The script added to the page. <% ' Add the button to the page ' Check to make sure querystring button is not set to hide If Request.QueryString("button") = "" Then %><!-- #include file="button.asp" --><% End If %> <html> <head> </html> |
The conversion script run when the button is clicked.
| The conversion script run when the button is clicked. <% ' Define Variables ' Get the URL to convert varURL = Request.Form("PDFURL") ' If the URL is empty go back to default page If varURL = "" Then %><SCRIPT LANGUAGE="JavaScript">history.go(-1)</SCRIPT><% End If ' Get the post data ' EngineToUse (1=IE, 0=Native) ' Timeout for various calls ' Set ASP Script Timeout ' Instantiate Objects ' Set activePDF Server properties ' Must call before DoPrint to pass server settings to WG ' Set WebGrabber properties ' Start the conversion process ' Wait for conversion result ' Run WG CleanUp ' Get New PDF filename ' Clear Objects ' Send the PDF to the browser |
