- Principle for printing in WEBDEV
Printing a report in WEBDEV
When creating a report, the test of this report can be run from the report editor.
You also have the ability to include this report in your applications or in your sites. The user or the Web user will have the ability to print the report from a button, a menu option, ... for example.
For a WEBDEV site, the server will prepare the report in the selected format (PDF, HTML, ...). Then, you will have the ability to:
- display this report on the browser of the Web user,
- save it on the server and propose to download it or to display it, ...
In an Intranet site, the report can also be printed on a local printer or on a network printer connected to the server.
Principle for printing in WEBDEV
Regardless of the type of report to print, the principle for printing a report is as follows (in server code):
- Specify the print mode of the report (direct print, generation of an HTML page, generation of a PDF file, ...) with iDestination.
- Start the print job with iPrintReport.
- Then, you will have the ability to:
- display the generated file on the computer of the web user with FileDisplay.
- send an email to the Web user allowing him to download the created file.
Caution: The following points must be checked if the destination of the print is a file in HTML, PDF, XML or RTF format:
- You have the rights to write into the directory where the document will be generated (the document is generated in the site directory by default).
If you generate a report in PDF format, this file can be saved in the data directory (path returned by fDataDir)
If you generate a report in HTML format, this file must be saved in the _WEB directory of the site (path returned by fWebDir).
- A specific name must be used for each document generated on the server. Otherwise, several simultaneous prints would overwrite the prints already performed.
Use ConnectionCount or GetIdentifier to name your reports (for example: FileName = "CustomerReport" + ConnectionCount() + ".HTML").
This principle must be adapted according to the data source used in each report.
The following paragraphs present: