FastReports / FastReport

Free Open Source Reporting tool for .NET6/.NET Core/.NET Framework that helps your application generate document-like reports

Home Page:https://www.fast-report.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Size of exported pdf

fernandocristan opened this issue · comments

Hello,

iam using in dotnet web api 6.0 and I noticed that when I export the pdf through the api, the file size is much larger than when exporting through the Community designer.

I created my report like this

webReport = new WebReport();
string path = Path.ChangeExtension(reportFilePath, "frx");
webReport.Report.Load(path);
webReport.Report.Dictionary.DataSources.Clear();
webReport.Report.Dictionary.ClearRegisteredData();

webReport.Report.Dictionary.RegisterBusinessObject(
    data: data,
    referenceName: "data",
    maxNestingLevel: data.Count(),
    enabled: true);

webReport.Report.RegisterData(
    data: data,
    name: "data");

webReport.Report.Prepare();

MemoryStream stream = new();
webReport.Report.Export(new PDFSimpleExport(), stream);
stream.Flush();
stream.Position = 0;

return new FileDTO(
    content: stream,
    contentType: "application/pdf",
    filename: "report.pdf");

The report is in the following layout

image

Size in API: 277 kb
Size in designer: 171 kb

In the designer I press CTRL + P and use the microsoft printer for pdf.

If there is any suggestion to decrease the size I would appreciate it.

thanks

The size of a PDF is because PDFSimpleExport transform content in a pdf/embeded image.

The size of a PDF is because PDFSimpleExport transform content in a pdf/embeded image.

Yeah. Do you know some alternative?

You can export to HTML and use another tool to transform content in a pdf

You can export to HTML and use another tool to transform content in a pdf

ah ok. Do you have any suggestion to transform in pdf?

I recommend try two packages, PuppeteerSharp (this is a port of a nodejs package, and use chromium V8 or itext7

In version 2024 of Community Designer CTRL + P is disabled, what a pitty :(