Get pdf from WebReport-object or from Report-object

OlaOla
edited 4:32AM in FastReport .NET
In my project I generate a Fastreport.Web.Webreport with a FastReport.Report that is shown to the user. I'm wondering if there is a way to get hold of the report on pdf-form from the Report-object or WebReport-object. (On code level that is, not by manually saving it from a preview window or anything.)

Comments

  • Use the PDFExport class.

    e.g;
    Report report = new Report();
    PDFExport reportexport = new PDFExport();
    report.Load("...reportpath/report.frx");
    
    // Prepare and export pdf
    byte[] pdf;
    report.Prepare();
    using (MemoryStream stream = new MemoryStream()) {
        report.Export(reportexport, stream);
        stream.Position = 0;
        pdf = stream.ToArray();
    }
    

Leave a Comment