Classic ASP

These initial tests ensure that the ScriptX components can be accessed and used with the current interactive user (which is known to work because validate.js can be used from the command line by the interative user). A server must not be configured in this way for production since it is both insecure and will fail if the server is rebooted (resulting in no interative account). If these tests are followed, then the steps outlined in the Configuration section must also be followed.

The ScriptX Server Side Test and Validation kit is available to licensees to illustrate different techniques (including Classic ASP) and to test and validate the installation. The use of this kit is highly recommended - the kit installs a website with suitable validations and tests in each language.

Alternatively, the following steps should be undertaken whilst logged onto the server machine under an account with Administrator privileges.

For IIS 6 and later (Windows Server 2003 and later), create an application pool for use by virtual applications/directories/sites that will use the ScriptX components.

  1. Using Internet Services Manager, create a suitable virtual application named "sxvalidate" and,

    1. For IIS 5/5.1, set Application Protection to Low (IIS Process), or

    2. For IIS 6 and later (Windows Server 2003/2008) set the application pool to that created for use with ScriptX and set the application pool identity to "Local system" (typically, the SYSTEM account is allowed to launch/access DCOM components).

    3. Example scripts are provided below that should be created manually ...

     

  2. Create a test asp page (testprint1.asp) with the following script in the created virtual directory:

    <%@ LANGUAGE="VBScript"%>
    <%
    Response.Expires = 0
    %>
    <HTML>
    <HEAD><TITLE>ScriptX Printing Server Test 1</TITLE></HEAD>
    <BODY>
    <H1>Testing ScriptX Printing.</H1>
    <h3>You are logged in as: [<%= Request.ServerVariables("LOGON_USER")%>] at: <%= Now %></h3>
    <%
    dim factory,p,secMgr
    dim a,b,c,d
    Set secMgr = Server.CreateObject("MeadCo.SecMgr")
    on error resume next
    
    ' Modify:: Change the following to use the license GUID and
    ' revision supplied to you.
    '
    secMgr.Apply "","{<YOUR LICENSE GUID>}",<YOUR LICENSE REVISION>
    if err.Number <> 0 then
        Response.Write "Unable to apply license: " & err.description & " (Error code: " & err.Number & ")"
    else
        Set factory = Server.CreateObject("ScriptX.Factory")
        factory.GetComponentVersion "ScriptX.Factory",a,b,c,d
        Response.Write("ScriptX version installed: " & a & "." & b & "." & c & "." & d & "<br>")
        set p = factory.printing
        if err.Number <> 0 then
            Response.Write "Unable to access printer object - there is a ScriptX configuration error. Error on create: " & err.description & " (Error code: " & err.Number & ")"
        else
            b = p.IsSpooling
            if err.Number <> 0 then
                Response.Write "Printing is not licensed: " & err.description & " (Error code: " & err.Number & ")"
            else
                Response.Write "Printing is licensed"
            end if
        end if
    end if
    set p = nothing
    factory.ShutDown
    set factory = nothing
    set secMgr = nothing
    %>
    </BODY>
    </HTML>
    

    Navigate to the page using Internet Explorer and verify that the page is displayed without errors and that printing is licensed. This test ensures that the ScriptX components are correctly installed and the license is available.

    Note:If the above test fails with a 0113 error (Script timed out), it is most likely that Application Protection is not set toLow (IIS Process) on the virtual directory.

    If the error "Permission denied" is received, then your DCOM configuration is not allowing launch of the "MeadCo TriPrint Server" by the SYSTEM account.

  3. If the error "Access denied" is received, then your DCOM configuration is not allowing access to the launched "MeadCo TriPrinter Server" object.

    If the error "Error on create: The server process could not be started because the configured identity is incorrect. Check the username and password" is received then either the user name and/or password for the configured identity on the MeadCo TriPrint Server object is wrong, or the configured identity is "Interactive user" and there is no interactive user.

     

  4. Create a test asp page (testprint2.asp) with the following script in the created virtual directory:

    <%@ LANGUAGE="VBScript"%>
    <%
    Response.Expires = 0
    %>
    <HTML>
    <HEAD><TITLE>ScriptX Printing Server Test 2</TITLE></HEAD>
    <BODY>
    <H1>Testing ScriptX Printing.</H1>
    <%
    dim factory,p,secMgr
    dim a,b,c,d
    Set secMgr = Server.CreateObject("MeadCo.SecMgr")
    on error resume next
    
    ' Modify:: Change the following to use the license GUID and
    ' revision supplied to you.
    '
    secMgr.Apply "","{<YOUR LICENSE GUID>}",<YOUR LICENSE REVISION>
    if err.Number <> 0 then
    Response.Write "Unable to apply license: " & err.description & " (Error code: " & err.Number & ")"
    else
    Set factory = Server.CreateObject("ScriptX.Factory")
    set p = factory.printing
    if err.Number <> 0 then
    Response.Write "Unable to access printer object - there is a ScriptX configuration error. Error on create: " & err.description & " (Error code: " & err.Number & ")"
    else
    Response.Write "The default printer is: " & p.DefaultPrinter() & "<br>"
    if err.Number <> 0 then
    Response.Write "No default printer available: " & err.description & " (Error code: " & err.Number & ") - a default printer is required."
    else
    Response.Write "The page headers are: " & p.header & "<br>"
    p.header = "ScriptX Printing - Printing at the Server"
    Response.Write "The updated page headers are: " & p.header & "<br>"
    Response.Write "The printer is: " & p.printer & "<br>"
    if err.Number <> 0 then
    Response.Write "There is a ScriptX configuration error: " & err.description & " (Error code: " & err.Number & ")"
    end if
    end if
    end if
    end if
    set p = nothing
    factory.ShutDown
    set factory = nothing
    set secMgr = nothing
    %>
    </BODY>
    </HTML>
    

    Navigate to the page using Internet Explorer and verify that the page is displayed without errors. This test ensures that the ScriptX components are correctly installed and the default printer for the current interactive account is accessible.

    If you receive the error: "No default printer available: PageSetup/Print Dialog system error: 00001008 - a default printer is required." and you have configure a named identity then it is likely that no service is running for that identity and so its registry hive has not been loaded. The Configuration section gives more details on the use of named identities.
      

  5. Create a test asp page (testprint3.asp) with the following script in the created virtual directory:

    <%@ LANGUAGE="VBScript"%>
    <%
    Response.Expires = 0
    %>
    <HTML>
    <HEAD><TITLE>ScriptX Printing Server Test 3</TITLE></HEAD>
    <BODY>
    <H1>Testing ScriptX Printing.</H1>
    <%
    dim factory,p,secMgr
    dim a,b,c,d
    Set secMgr = Server.CreateObject("MeadCo.SecMgr")
    on error resume next
    
    ' Modify:: Change the following to use the license GUID and
    ' revision supplied to you.
    '
    secMgr.Apply "","{<YOUR LICENSE GUID>}",<YOUR LICENSE REVISION>
    if err.Number <> 0 then
    Response.Write "Unable to apply license: " & err.description & " (Error code: " & err.Number & ")"
    else
    Set factory = Server.CreateObject("ScriptX.Factory")
    set p = factory.printing
    if err.Number <> 0 then
    Response.Write "Unable to access printer object - there is a ScriptX configuration error. Error on create: " & err.description & " (Error code: " & err.Number & ")"
    else
    
    p.header = "ScriptX Printing - Printing at the Server"
    p.footer = "Printed at the server"
    p.printHTML "http://localhost/default.htm" ' Change this URL to an appropriate page on your server.
    
    if err.Number <> 0 then
    Response.Write "Printing failed: " & err.description & " (Error code: " & err.Number & ")"
    else
    Response.Write "<p>The page has been printed.</p>"
    end if
    
    end if
    end if
    set p = nothing
    factory.ShutDown
    set factory = nothing
    set secMgr = nothing
    %>
    </BODY>
    </HTML>
    

    Navigate to the page using Internet Explorer and verify that the page is displayed without errors. This test ensures that the ScriptX components are correctly installed and the default printer for the current interactive account is accessible and printing to the printer.

    Note: If the above test fails with "Unspecified error" the most likely cause is that a valid printer is not available and cannot be accessed.

  6. If you are intending to use MaxiPT to provide additional control of printed documents,. create a test asp page (testprint4.asp) with the following script in the created virtual directory:

    <%@ LANGUAGE="VBScript"%>
    <%
    Response.Expires = 0
    %>
    <HTML>
    <HEAD><TITLE>ScriptX Printing Server Test 4</TITLE></HEAD>
    <BODY>
    <H1>Testing ScriptX Printing with MaxiPT.</H1>
    <%
    dim factory,p,secMgr,maxpipt
    dim a,b,c,d
    Set secMgr = Server.CreateObject("MeadCo.SecMgr")
    on error resume next
    
    ' Modify:: Change the following to use the license GUID and
    ' revision supplied to you.
    '
    secMgr.Apply "","{<YOUR LICENSE GUID>}",<YOUR LICENSE REVISION>
    if err.Number <> 0 then
    Response.Write "Unable to apply license: " & err.description & " (Error code: " & err.Number & ")"
    else
    Set factory = Server.CreateObject("ScriptX.Factory")
    Set maxipt = CreateObject("MeadCo.MaxiPT")
    set p = factory.printing
    if err.Number <> 0 then
    Response.Write "Unable to access printer object - there is a ScriptX configuration error. Error on create: " & err.description & " (Error code: " & err.Number & ")"
    else
    ' Set a header and footer - note that these will be overridden
    ' by the printing rules specified in the document being printed.
    '
    p.header = "ScriptX Printing - Printing at the Server"
    p.footer = "Printed at the server with MaxiPT"
    
    ' apply maxiPT template for printing rather than the standard
    p.templateUrl = maxipt.Template
    
    p.printHTML "http://localhost/testsx/maxiptout.asp" ' Change this URL to an appropriate page on your server.
    
    if err.Number <> 0 then
    Response.Write "Printing failed: " & err.description & " (Error code: " & err.Number & ")"
    else
    Response.Write "<p>The report has been printed."
    end if
    end if
    end if
    set p = nothing
    maxipt.ShutDown
    factory.ShutDown
    set factory = nothing
    set secMgr = nothing
    %>
    </BODY>
    </HTML>
    

    You will also need to create the target document to be printed (maxiptout.asp):

    <%@ LANGUAGE="VBScript" %>
    <%
    Response.Expires = -1
    Response.CacheControl = "no-cache"
    call Response.AddHeader("Pragma", "no-cache")
    %>
    <HTML>
    <HEAD>
    <TITLE>MaxiPT Controlled Output</TITLE>
    <script>
    // This page is printed with the MaxiPT template applied to
    // the process doing the printing
    //
    // This gives this document the opportunity to specify how it
    // wants to be printed.
    //
    // Please see the MaxiPT documentation for full details.
    //
    function initialiseMaxiPT() {
    
    document.expando = true;
    
    document.printingRules = {
    diffFirstPageHeadFoot: true,
    allPagesHeadFoot: true,
    pageRange: "",
    printingPass: "all",
    mirrorMargins: true,
    setupButton: "show",
    setupExtraButton: "enabled"
    
    }
    
    document.printingRules.extraFirstPageFooter = "<div style='border: thin inset threedface; font: 15pt Comic Sans MS; background: lavender; color: orchid'><center><b>Extra Footer</b> for the First Page</center></div>";
    document.printingRules.firstPageHeader = "<div style='border: thin inset threedface; font: 15pt Comic Sans MS; background: lightskyblue; color: darkblue'><center><i>--- Header for page <b> &p </b>---</i></center></div>";
    document.printingRules.firstPageFooter = "<div style='border: thin inset threedface; font: 15pt Comic Sans MS; background: lightskyblue; color: darkblue'><center><i>--- Footer for page <b> &p </b> ---</i></center></div>";
    document.printingRules.allPagesHeader = "<div style='border: thin inset threedface; font: 15pt Comic Sans MS; background: antiquewhite; color: darkgreen'><center><i>--- Header for page <b> &p </b>---</i></center></div>";
    document.printingRules.allPagesFooter = "<div style='border: thin inset threedface; font: 15pt Comic Sans MS; background: antiquewhite; color: darkgreen'><center><i>--- Footer for page <b> &p </b> ---</i></center></div>";
    }
    </script>
    </HEAD>
    
    <BODY onload="initialiseMaxiPT()">
    <H1>MaxiPT with Server Side Printing Test</H1>
    <p>The time at the server is: <%= Now %></p>
    </BODY>
    </HTML>
    

    Navigate to the test page using Internet Explorer and verify that the page is displayed without errors. This test ensures that the ScriptX components are correctly installed and the default printer for the current interactive account is accessible and printing to the printer.

That completes the initial testing of the ScriptX installation. At the succesful completion of these tests, the software is known to be installed correctly and licensed. From here on in, all problems are to do with the security configuration of the machine. Please now follow the steps outlined in Configuration to complete installation of ScriptX Server-side.

 

::> ASP.NET