How to send report in PDF through FTP

2017-02-27

FastReport .Net allows you to export reports in various formats, send them via Email, as well as via FTP. In this article, I want to focus on the transfer to the server via FTP reports. It should be noted, it is not very convenient to run each report and manually perform sending via FTP. What if a large number of reports should be sent to the server?

What are the solutions to this problem:

  1. Send all report files directly using the file manager with FTP-connections. Butbefore all reports should be exported to the desired format;
  2. Arrange export and send  report using FastReport, but do it in the application code.

Obviously, the second way will save time when you export the report in the desired format. In addition, you can completely automate this process. For example, to lay out all of the reports to a server on a schedule or one click a button.

I will show an example in which you will see the simplicity of an operation such as sending report via FTP from the application code.

Create a Windows Forms application. Place a button on the form.

Add the libraries into "using":

1
2
3
using FastReport;
using FastReport.Export;
using FastReport.Utils;

 Add the code for the button click handler:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
 private void button1_Click(object sender, EventArgs e)
 {
 Report report1 = new Report(); //Create new report
 FastReport.Export.Pdf.PDFExport pdf = new FastReport.Export.Pdf.PDFExport(); //Create pdf export object
 report1.Load(Environment.CurrentDirectory+"\\text.frx"); //Load report
 report1.Prepare(); //Prepare report
 
 FastReport.Cloud.StorageClient.Ftp.FtpStorageClient ftp = new FastReport.Cloud.StorageClient.Ftp.FtpStorageClient(); //Create ftp client
 //ftp connection settings
 ftp.Server = "78.47.131.251/Reports";
 ftp.Username = "user";
 ftp.Password = "password";
 ftp.SaveReport(report1, pdf); //Send report
 }

First we create an instance of the report object. Then create the export object to PDF. Then we load the report and perform its construction (Prepare). Create a client to work with FTP. You must specify all three properties: the server, user and password. Do not forget that you need to specify the path to the desired folder, otherwise the reports will be placed directly in the root. Finally, we send a report to the server. As the parameters pass the report itself and export to PDF. FastReport will make a report export and send via FTP prepared file in pdf.

Start the app, press the button and check the existence of the file on the server:

Using this simple procedure, you can send multiple reports in any of the available formats,  HTML for instance. So you can design the reports on a local computer and share them on your website.

 

 

.NET .NET Export Export FastReport FastReport PDF PDF
October 13, 2025

How to Use Excel Formulas in a Report When Exporting to MS Excel

Starting with version FastReport .NET 2026.1, it is now possible to export formulas to Microsoft Excel. It is important to set up formula exports correctly and follow the syntax.
September 30, 2025

How to Install the FastReport .NET Report Designer with Pre-installed Plugins

Read the article as from version 2025.2.5 for FastReport .NET WinForms and FastReport .NET WEB allows you to install a report designer with all plugins without building dll files.
September 23, 2025

How to Export a Report to JPEG / PNG / BMP / GIF / TIFF / EMF from FastReport .NET

In this article, we will look at how to easily and efficiently export reports from FastReport .NET in JPEG, PNG, BMP, GIF, TIFF and EMF.

© 1998-2025 Fast Reports Inc.