NetTalk WebServer - Adding Reports to an Application
  NetTalk header  
Version version number beta
CapeSoft Software copyright
www.capesoft.com
Updated
03 November 2011
     

NetTalk WebServer - Using Reports in a Webserver Application

Introduction

There are various way to approaching printing in a WebServer application.

Firstly it should be remembered that the printing is a function of the browser. Which means that any page your application delivers is intrinsically a report. The user can click on the browser print option at any time. By careful design, and attention to the information you are presenting, you can make many "reports" obsolete.

There are times though where a specifically formatted document is necessary. In these cases HTML doesn't necessarily offer the degree of control that you need. The best option in this situation is to create a PDF file, and have the browser display this.

Since Clarion 6 Enterprise Edition contains a Report-To-PDF extension, this seems like a good place to start. You can take existing report procedures in your application, and with minor additions make it generate a PDF file, and also allow the NetTalk WebServer to send the PDF file to the browser. PDF makes an excellent format for this sort of thing because most browsers already know how to display a PDF (via the Adobe plugin) and you have 100% control over how the page will be displayed, and importantly 100% control over how it will look when printed.

If you don't have Clarion 6 EE, then there are other 3rd party tools that can be purchased that do a similar thing. NetTalk 4 includes examples of using the Clarion 6 EE functionality, as well as examples from other vendors.

Adding SoftVelocity PDF functionality to your report

Clarion 6 Enterprise Edition includes functionality to turn an existing report into a PDF file. If you only have Clarion 6 PE then this is available separately.

Example 13 (ABC), and Example 38 (Legacy) in the list of NetTalk Web Server examples are examples of doing this.

Note Legacy Templates: In order to use the SV PDF Global Extension you will need to go to Global Properties, Classes Tab, And tick on the option "Enable the use of ABC Classes. This explanation assumes you have a report procedure already, based on the normal Report template.
  1. Add the "Report to PDF Global" global extension to your application.
  2. In the report procedure, go to extensions. You'll see the report to PDF extension already there. You can set the settings for this extension as you like. (See SV docs and help files for what the extension can do). 

     
     
  3. Add the NetTalk extension NetWebReportABC to this procedure
     
  4. On the properties screen for the procedure set the Prototype to
    (<NetWebServerWorker p_web>)
    and set the Parameters to
    (<NetWebServerWorker p_web>)
     
  5. Note: Make sure the Print Preview functionality for the report is turned ON. The PDF engine requires this. The NetTalk template will suppress the actual preview though - since the preview would appear on the server (where no-one is looking.)
     
  6. Click on the Project menu and select Generate All.

Now that your report procedure is ready, all you need to do is link it from a web page.

In the example, the report procedure is called MailboxesReport. The menu for this application is in the PageHeaderTag procedure. One of the menu items there calls the report (by setting the URL to 'MailBoxesReport'. Also notice that the Target is set to '_blank' which will cause the finished PDF file to open in it's own browser window.

Adding PDF-Tools functionality to your report

An alternative to the built-in Clarion 6 PDF functionality is PDF-Tools SDK, from Tracker Software.

Example 14 in the list of NetTalk Web Server examples is an example of using this to generate the PDF files.

  1. Add the Global template "PDF-Tools Report Global Extension 3.5" to your application.
    The default settings for the extension should be fine.
     
  2. Add the "PDF-Tools Report Procedure Extension 3.5" to the report procedure you wish to add
    PDF output to. The defaults will be inherited form the Global Template. Most of the defaults are fine, however make sure the following items are set correctly:

    General Tab:
    Set FileName to !loc:PDFname

    Previewer Tab:
    Generate PDF: Yes - Always
    Show Generate PDF: No - Never 
    PDF Viewer Option: None
    Run Print Previewer: No - Never 
    Print Hardcopy: No - Never 
  3. Add the NetTalk, NetWebReportxc extension to the procedure
     
  4. On the properties screen for the procedure set the Prototype to
    (<NetWebServerWorker p_web>)
    and set the Parameters to
    (<NetWebServerWorker p_web>)
     
  5. Click on the Project menu and select Generate All.

Now that your report procedure is ready, all you need to do is link it from a web page.

In the example, the report procedure is called MailboxesReport. The menu for this application is in the PageHeaderTag procedure. One of the menu items there calls the report (by setting the URL to 'MailBoxesReport'. Also notice that the Target is set to '_blank' which will cause the finished PDF file to open in it's own browser window.

[End of this document]
RReturn to NetTalk Documentation Index