NetTalk WebServer - Using Reports in a Webserver Application
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.
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.
- Add the "Report to PDF Global" global extension to your application.
- 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).
- Add the NetTalk extension NetWebReportABC to this procedure
- On the properties screen for the procedure set the Prototype to
(<NetWebServerWorker p_web>)
and set the Parameters to
(<NetWebServerWorker p_web>)
- 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.)
- 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.
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.
- Add the Global template "PDF-Tools Report Global Extension 3.5" to
your application.
The default settings for the extension should be fine.
- 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 |
- Add the NetTalk, NetWebReportxc extension to the procedure
-
On the properties screen for the procedure set the Prototype to
(<NetWebServerWorker p_web>)
and set the Parameters to
(<NetWebServerWorker p_web>)
-
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]