Skip to content

MarcoBellini/MarcoBellini.FastReport.PDFExporter

Repository files navigation

MarcoBellini.FastReport.PDFExporter

NuGet License: MIT Platform: Windows

Improved PDF Exporter for FastReport Open Source using PDFSharp-GDI as the rendering engine.

This project aims to improve PDF generation quality and reduce output file size compared to the default PDF exporter shipped with the FastReport Open Source edition.

Note: This project is not intended to replace FastReport's commercial offerings. If you need advanced or enterprise-grade features, consider the official commercial products.


Key Features

  • Higher-quality PDF rendering compared to the default FastReport Open Source exporter
  • Typically smaller PDF output files
  • Rendering based on PDFSharp-GDI (GDI-based font resolver)

Requirements

  • .NET 8 or later
  • Windows OS (see Platform Support)
  • FastReport Open Source (compatible versions: >=2026.1.4)

Installation

Install via NuGet Package Manager:

dotnet add package MarcoBellini.FastReport.PDFExporter

Usage

Basic export to file

using MarcoBellini.FastReport.PDFExporter;

void ExportReport()
{
    using var report = new Report();
    using var pdfExport = new PDFExport();

    report.Load("Reports/MyReport.frx");
    report.Prepare();

    var outputPath = Path.Combine(Path.GetTempPath(), "Report.pdf");
    report.Export(pdfExport, outputPath);
}

Export to a memory stream (e.g. for ASP.NET Core responses)

using MarcoBellini.FastReport.PDFExporter;

byte[] ExportReportToBytes()
{
    using var report = new Report();
    using var pdfExport = new PDFExport();
    using var stream = new MemoryStream();

    report.Load("Reports/MyReport.frx");
    report.Prepare();
    report.Export(pdfExport, stream);

    return stream.ToArray();
}

Export with data source

using MarcoBellini.FastReport.PDFExporter;

void ExportReportWithData(IEnumerable<MyRecord> data)
{
    using var report = new Report();
    using var pdfExport = new PDFExport();

    report.Load("Reports/MyReport.frx");
    report.RegisterData(data, "MyDataSource");
    report.Prepare();

    var outputPath = Path.Combine(Path.GetTempPath(), "Report.pdf");
    report.Export(pdfExport, outputPath);
}

Platform Support (Windows Only)

This exporter is Windows-only due to the following dependencies:

  • FastReport Open Source relies on System.Drawing.Common, which Microsoft has restricted to Windows starting with .NET 6 (see docs)
  • PDFSharp-GDI uses GDI for font resolving and rendering

It can be used in:

  • Windows desktop applications (WinForms, WPF, console)
  • ASP.NET Core, as long as it runs on a Windows host

Limitations

Unsupported Brush Types

The following brush types are not compatible with PDFSharp and will not render correctly:

  • PathGradientBrush
  • HatchBrush
  • TextureBrush

Why? PDFSharp does not have a direct equivalent for these GDI+ brush types, so they cannot be translated into PDF drawing instructions.

Pen LineCap Limitations

  • Pens with different start and end caps are not supported
  • LineCap.Triangle is not supported

Dependencies / Related Projects


Contributing

Contributions, bug reports, and feature requests are welcome! Feel free to open an issue or submit a pull request.

Please make sure to:

  • Describe the problem or improvement clearly
  • Include a minimal reproducible example if reporting a bug
  • Follow the existing code style

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Improved PDF Exporter for FastReport OpenSource using PDFSharp

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages