FastReports / FastReport

Free Open Source Reporting tool for .NET6/.NET Core/.NET Framework that helps your application generate document-like reports
https://www.fast-report.com
MIT License
2.71k stars 604 forks source link

PdfSimpleEport - Encoding of PdfInfo fields (Title,Subject,etc) is incorrect #343

Closed mskinner-au closed 10 months ago

mskinner-au commented 3 years ago

PdfInfo contains a number of fields that contain meta data about the document. These are displayed in the document properties of Acrobat, or the tab of a web browser (for Title). Currently the static fields (Creator and Producer) are being encoded as HEX values, but the public fields are not. The readers I have tried are not rendering this data correctly. My testing indicates that changing the public fields to also be HEX encoded resolves the issue (e.g. changing the setters to be this[key] = new PdfString(value, true);)

Examples of current rendering: image image

wagenheimer commented 8 months ago

I also have this problem. It is more visible on Microsoft Edge but happens on all the Browsers.

public static FileContentResult ExportaPdf(Report report, string reportName)
{
    FastReport.Export.PdfSimple.PDFSimpleExport pdfSimpleExport = new FastReport.Export.PdfSimple.PDFSimpleExport();
    pdfSimpleExport.ShowProgress = true;
    pdfSimpleExport.Subject = SanitizeName(reportName);
    pdfSimpleExport.Name = SanitizeName(reportName);

    MemoryStream stream = new MemoryStream();

    report.Report.Export(pdfSimpleExport, stream);
    stream.Flush();
    report.Dispose();
    pdfSimpleExport.Dispose();
    stream.Position = 0;

    return new FileContentResult(stream.ToArray(), "application/pdf");
}

Result :

image

Was it really fixed?