.Net Framework - print a report without user interface

Hi,

I am using VS2022 to print a report (or create a PDF) from an app without a user interface - it will run twice a day (using task scheduler), get data from an SQL DB, generate a report, export it to PDF and send it by email.

I managed to do this, however, when I call FastReport.Prepare a windows is shown briefly.

Is there any way that FastReport.Prepare runs without any user interface?

TIA,

Carlos

Comments

  • Carlos,

    Try adding the line below BEFORE making the call to prepare the report.

    FastReport.Utils.Config.ReportSettings.ShowProgress = False

    FastReport.Prepare()

  • yes, somethig like this,

    exportpdf = new PDFExport();

    exportpdf.ShowProgress = false;

    exportpdf.Compressed = true;

    exportpdf.Background = false;

    exportpdf.TextInCurves = false;

    exportpdf.PrintOptimized = true;

    exportpdf.ImagesOriginalResolution = false;

    exportpdf.ColorSpace = PDFExport.PdfColorSpace.RGB;

    exportpdf.JpegCompression = true;

    exportpdf.EmbeddingFonts = true;

    FastReport.Utils.Config.ReportSettings.ShowProgress = false;


    ResultFile = new MemoryStream();

    fastReportObject.Prepare();

    fastReportObject.Export(exportpdf, ResultFile);// export fastreport object to pdf   


    Best Regard

    Jai

  • Hello!

    To completely disable progress pop-ups during background printing or PDF export, disable the ShowProgress flag for the reporting engine and the exporter/printer before running:

    using FastReport.Utils;
    using FastReport.Export.Pdf;
    
    Config.ReportSettings.ShowProgress = false;
    Config.ReportSettings.ShowPerformance = false;
    
    report.Load(‘template.frx’);
    report.Prepare();
    
    using var pdf = new PDFExport { ShowProgress = false };
    report.Export(pdf, ‘output.pdf’);
    
    // When printing directly in WinForms / .NET Framework:
    report.PrintSettings.ShowPrintDialog = false;
    // report.Print();
    
This discussion has been closed.