PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • How to proceed?
  • Generating a PDF file on the Web server
  • Downloading the PDF file
  • Deleting the PDF file
  • Example
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Downloading a report in PDF format on the computer of the Web user
Overview
To propose to download a report in PDF format on the computer of the Web user, you must:
  • generate the PDF file on the Web server.
  • propose to download the generated file on the computer of the Web user.
  • delete the PDF file from the Web server.
How to proceed?

Generating a PDF file on the Web server

To generate a PDF file on the Web server:
  1. Create a unique name for the PDF file to generate. The creation directory of this file must be accessible in read/write (the directory of the data files or the "<MyProject>_WEB" directory of the site for example).
    See Defining a unique name for the generated file for more details.
  2. Configure the print destination with iDestination associated with the iPDF constant (print in a PDF file).
  3. Specify the name of the report to print in iPrintReport.
    The PDF file is created on the Web server.

Downloading the PDF file

To propose to download the generated file on the computer of the Web user, use FileDisplay.

Deleting the PDF file

To reduce the disk space occupied by the reports in PDF format on the Web server, we advise you to delete the unused reports on a regular basis. You can, for example, remove the report once it has been downloaded or create a procedure used to erase the reports generated during a day.
Example
The "RPT_OrderPDF" report is a report in PDF format proposed for download.
The "BTN_DownloadOrder" button is used to:
  • generate the PDF file in the "<ProjectName>_WEB" directory of the site.
  • propose to download the report in PDF format.
  • delete the PDF report once it is downloaded.
In this example, the server click code of "BTN_DownloadOrder" button is as follows:
// Generate a unique PDF file name
AFile is string = fWebDir() + "\" + DateSys() + TimeSys() + ".pdf"  
// Configure the destination of the print
iDestination(iPDF, AFile)  
// Print the RPT_OrderPDF report
iPrintReport(RPT_OrderPDF)  
// Propose to download the file
// The file name proposed by default will be "Order.pdf"  
FileDisplay(AFile, "application/pdf", "Order.pdf")  
// Delete the file
fDelete(AFile)
Minimum required version
  • Version 9
Comments
Click [Add] to post a comment