logo
small logo
  • Products
  • Buy
  • Support
  • Articles
  • Customer panel Support
    • en
    • pt
    • es
    • de
    • pl
    • JP
    • ZH
  • Home
  • /
  • Articles
  • /
  • How to send report in PDF through FTP
  • Interactive forms in PDF export Fast Report .NET 2018

    January 17, 2018

    It's no secret that the PDF standard allows you to create fillable forms. That is,

    read more
  • CMYK in PDF export

    April 7, 2017

    CMYK is a color model based on a synthesis of any color that is based

    read more
  • How to protect your PDF?

    November 30, 2020

    On the Data protection day, we decided to prepare an article about the PDF documents

    read more
  • The Event of ExportParameters in WebReport.Report

    October 5, 2020

    In FastReport 2020.1 we have added the ability to change export parameters. To do this,

    read more
  • MS Word format vs. Open Document Text. Which is better?

    October 19, 2020

    Speaking of text editors, we immediately present coryphaeus as Microsoft Word, which for many years

    read more

How to send report in PDF through FTP

February 27, 2017

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.

 

 

about product download buy
avatar
Dmitriy Fedyashov
Technical Writer
Fast Reports Team: Dmitriy Fedyashov - Technical Writer at Fast Reports
.NET Export FastReport PDF

Add comment
logo
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • info@fast-report.com
  • 901 N Pitt Str #325 Alexandria VA 22314
  • Buy
  • Download
  • Documentation
  • Testimonials
  • How to uninstall
  • Ticket system
  • FAQ
  • Tutorial Video
  • Forum
  • Articles
  • Our News
  • Press about us
  • Resellers
  • Contact us

© 1998-2022 by Fast Reports Inc.

  • Privacy Policy