|
Purepage SDK Active Server Pages (Beginner)
Written in VBScript for use with Active Server Pages (ASP) on IIS 4 or 5 or PWS.
This example demonstrates how to convert basic files into HTML using Purepage SDK and Active Server Pages (ASP). You can use this example as a base to build your own code around.
This sample can be found in the ASP sub-folder when you download the trial version of Purepage.
Main points of interest include:
- Active Server Pages use of Purepage SDK.
- Takes you through the process of converting a printed job into HTML.
- Simple use of the Purepage COM objects methods.
- Returning to the user a link to the converted document.
<HTML> <HEAD> <TITLE>Purepage ASP Example</TITLE> </HEAD> <BODY>
<%
' NOTE: ' You will need the following software installed on your ' Windows NT or 2000 server to use this sample: '
' - PurePage
' - Change the IIS MetaBase to allow out-of-process COM ' servers to run. See the following URL:
' http://support.microsoft.com/support/kb/articles/Q184/6/82.ASP
' - See the following tech-notes for ASP and Purepage setup: ' http://www.purepage.com/technotes/00178/
' http://www.purepage.com/technotes/00203/ ' http://www.purepage.com/technotes/00245/
' - IMPORTANT: ' Microsoft does not support the automation of MS Office from ASP.
' You should read and understand the following article before ' attempting to use Purepage to convert MS Office documents from ASP: ' http://support.microsoft.com/support/kb/articles/Q257/7/57.ASP
' Declare some basic variables for later use. Dim PPServer Dim JobName Dim ErrorCode
' Create a PurePage PPServer object. Set PPServer = Server.CreateObject("PurePage.PPServer")
' Make sure we do not use MS Word for printing this file. PPServer.ExtractWordHeadings = 0 PPServer.UseOfficeAutomation = 0
' Lock the Purepage printer, print a document and ' get the printed job name for the printed document. PPServer.StartPrint
PPServer.PrintFiles 0, "C:\Program Files\PurePage\Whats New.txt" & vbCrLf, 1 JobName = PPServer.GetLastPrintedJob PPServer.StopPrint
' Convert the printed job to HTML. ErrorCode = PPServer.ConvertPrintedJobToHTML(JobName, 0, 0)
' Handle any errors that occur during conversion. If (ErrorCode <> 0) Then ErrorStr = PPServer.GetErrorString(ErrorCode)
Response.Write("<p>There was an error: " & ErrorStr) Else Response.Write("<p>Here is a link to the converted document:<br>")
strFilename = PPServer.GetPublishedDocFolder(JobName) & PPServer.HtmlFilename & PPServer.HtmlExtension %>
<A HREF="<% Response.Write(strFileName) %>"><% Response.Write(strFileName) %></A> <% End If
' Delete the printed job. PPServer.DeletePrintedJob JobName PPServer.CleanPrintQueue
' Tidy up and free memory. Set PPServer = Nothing
%>
</BODY> </HTML>
<< Previous Example Next Example >>
|