When you invoke the Acu-report-Preview and Acu-report-DO-PRINT routines, AcuBench uses a library called AcuBenchPrint.dll to call the Internet Explorer functions needed to preview or print the report. This means that if you want to use AcuBench functions to preview or print a report in a thin client environment, you need to first copy the report and DLL to the report host, then perform a preview or print routine.
The general steps involved are as follows:
This DLL should be placed in the same directory as the thin client executable (acuthin.exe).
The following example demonstrates the code used to perform steps 3 and 4. In the sample program, the user pushes a button to create the report, which is then displayed with the preview function:
ReportPB-Link. IF IS-REMOTE PERFORM ACU-REPORT1-THINPREVIEW ELSE PERFORM ACU-REPORT1-PREVIEW END-IF. * ACU-REPORT1-THINPREVIEW. PERFORM Acu-Report1-PRINT-TOFILE * CALL "C$COPY" USING "/home/data/Report1.html", "@[DISPLAY]:C:\Localdata\Report1.html". * PERFORM Acu-Report1-PRINT-PARA * STRING "C:\Localdata\Report1.html", delimited by size, X"00", delimited by size, into PRT-FULLFILENAME. * SET ENVIRONMENT "DLL_CONVENTION" to "1" CALL "AcuBenchPrintDummy" ON EXCEPTION CALL "AcuBenchPrint.dll" END-CALL END-CALL CALL "AcuBenchPrintExecWBPreview" USING BY CONTENT PRT-FULLFILENAME, BY CONTENT PRINT-BROWSER-PARA, BY CONTENT ACU-PAPER-HEADER, BY CONTENT ACU-PAPER-FOOTER, BY CONTENT ACU-PAPER-SIZE, BY VALUE ACU-PAPER-ORIENTATIONINT, BY CONTENT ACU-PRINTER-NAME END-CALL .
The push button code uses the IS-REMOTE flag in the TERMINAL-ABILITIES structure to test whether the program is running locally or on a remote server. If it is running remotely, a paragraph called Acu-Report1-ThinPreview is executed.
The code in the Acu-Report1-ThinPreview paragraph starts by executing the AcuBench-generated PRINT-TOFILE paragraph. It then calls C$COPY to transfer the HTML file to the local machine. Next, it uses a STRING statement to reset the PRT-FULLFILENAME parameter to the location of the HTML file on the client machine. (Note that the PRT-FULLFILENAME string is terminated by low-values.) Finally, with code copied from the AcuBench-generated Acu-Report1-Preview paragraph (found in the .rpt COPY file), it calls the DLL and invokes the preview function.
With CODE_MAPPING set to on, the configuration file can contain instructions for mapping these calls to AcuBenchPrint.dll, which, in our sample, is located in the C:\Localdata directory on the client machine, as shown:
CODE_MAPPING ON DLL_CONVENTION 1 ACUBENCHPRINT.DLL @[DISPLAY]:C:\Localdata\AcubenchPrint.DLL ACUBENCHPRINTDUMMY @[DISPLAY]:AcuBenchPrintDummy ACUBENCHPRINTEXECWBPREVIEW @[DISPLAY]:AcuBenchPrintExecWBPreview
The complete sample code for this example can be found in the Support section of the Micro Focus Web site. For detailed information about the @[DISPLAY]: notation and other thin client functions, refer to the AcuConnect User's Guide.