The PEERNET Reports Applet allows you to automate the preview and printing operations, and can also be used to automatically print reports or labels without first previewing them. As well, the PEERNET Reports Applet has a callable interface, so it can be used with JavaScript.

 

To use the PEERNET Reports Applet, you must first define a request with a ConvertTo configured to use the PEERNET Print Applet Writer. Then, embed an HTML applet tag of the form:

 

<APPLET NAME="PEERNETReportsApplet1" ARCHIVE=applet/PEERNETReportsApplet1.jar  

   CODE="com.peernet.PeernetReportApplet1.PeernetReportApplet1.class"  width="473" height="281">

<PARAM NAME="PREVIEW" VALUE="Yes">

   PEERNET Reports Applet requires Sun Java Plugin 1.4 or better!

</APPLET>

 

<APPLET NAME="PEERNETReportsApplet2"

ARCHIVE=http://<webserver>:<port>/PEERNETReportsServer3/applet/PEERNETReportsApplet1.jar  

CODE="com.peernet.PeernetReportApplet1.PeernetReportApplet1.class" WIDTH="16" HEIGHT="1">

   PEERNET Reports Applet requires Sun Java Plugin 1.4 or better!

</APPLET>

 

<APPLET NAME="PEERNETReportsApplet1" ARCHIVE=applet/PEERNETReportsApplet1.jar  

   CODE="com.peernet.PeernetReportApplet1.PeernetReportApplet1.class"  width="473" height="281">

<PARAM NAME="PREVIEW" VALUE="Yes">

<PARAM NAME="URL” VALUE="http://<webserver>:<port>/PEERNETReportsServer3/PEERNETReportsServerRequestServlet?PROJECT=<project>&REQUEST=<request>">

   PEERNET Reports Applet requires Sun Java Plugin 1.4 or better!

</APPLET>

 

<APPLET NAME="PEERNETReportsApplet1" ARCHIVE=applet/PEERNETReportsApplet1.jar  

   CODE="com.peernet.PeernetReportApplet1.PeernetReportApplet1.class"  width="16" height="1">

<PARAM NAME="URL” VALUE="http://<webserver>:<port>/PEERNETReportsServer3/PEERNETReportsServerRequestServlet?PROJECT=<project>&REQUEST=<request>">

   PEERNET Reports Applet requires Sun Java Plugin 1.4 or better!

</APPLET>

 

You can also use a visual HTML editor to perform this task; insert the applet and set the properties as required.

 

You can then use JavaScript to perform the preview or printing operations. The code snippets below show you how to call the printReport or previewReport methods of the applet. If you set the URL parameter, the applet will automatically retrieve the content of the URL. If you set the parameter PREVIEW to Yes, the applet will preview the document and provide navigation and print buttons to the user; otherwise, the applet will automatically print the document with no user interaction.

 

function PrintDocument( showdialog )

{

 

   cmd = "http://<webserver>:<port>/PEERNETReportsServer3/PEERNETReportsServerRequestServlet?PROJECT=<project>&REQUEST=<request>";

 

 document.PEERNETReportsApplet2.printReport( cmd, null, showdialog ) ;

 

 status2 = document.PEERNETReportsApplet2.getStatus() ;

 

 //        Wait for load of document to complete

 while ( status2 & 1 )

         status2 = document.PEERNETReportsApplet2.getStatus() ;

         

 // Wait for document to be sent to the printer

 while( status2 & 16)

         status2 = document.PEERNETReportsApplet2.getStatus() ;

 

 state = "No Status" ;

 

 if ( status2 & 1 )

          state = "Loading document from specified location" ;

 if ( status2 & 2 )

          state = "Finished Loading document from specified location" ;

 if ( status2 & 4 )

          state = "Failed to load document from specified location" ;

 

 if ( status2 & 16 )

          state = "Printing the document " ;

 if ( status2 & 32 )

          state = "Finished printing the document " ;

 if ( status2 & 64 )

          state = "Failed to print the document " ;

 

}

 

function LoadDocument()

{

 

   cmd = "http://<webserver>:<port>/PEERNETReportsServer3/PEERNETReportsServerRequestServlet?PROJECT=<project>&REQUEST=<request>";

 

 document.PEERNETReportsApplet1.previewReport( cmd, null, false ) ;

 

 status2 = document.PEERNETReportsApplet1.getStatus() ;

 

 //        Wait for load of document to complete

 while ( status2 & 1 )

         status2 = document.PEERNETReportsApplet1.getStatus() ;

         

 state = "No Status" ;

 

 if ( status2 & 1 )

          state = "Loading document from specified location" ;

 if ( status2 & 2 )

          state = "Finished Loading document from specified location" ;

 if ( status2 & 4 )

          state = "Failed to load document from specified location" ;

 

}