Problems with exporting to pdf

Posted by: info on 11 July 2022, 12:07 am EST

  • Posted 11 July 2022, 12:07 am EST

    i am using the flexreport in an core mvc application.
    Everything works fine if I render and print the report in A4.

    If, on the other hand, I export it to PDF, the page size changes making the document not conform to A4 format.

    The code is very simple.

    I am attaching both the report and the generated PDF file and the code.
    Can someone help me?
    Thanks, regards,
  • Replied 11 July 2022, 12:11 am EST
  • Replied 11 July 2022, 12:11 am EST

    Pdf Exported
  • Replied 12 July 2022, 6:08 pm EST

    Hi, here the code.
    In the report the a4 format is set, in the PDF the dimension is set to 280x396mm.
    Any suggest?

    C1FlexReport report = new();
    report.Load(filePathName, reportName);
    foreach (DataSource dataSource in report.DataSources)
    dataSource.DataProvider = DataProvider.OLEDB;
    dataSource.RecordSource = recordSource ?? string.Empty;
    dataSource.RecordSourceType = recordSourceType ?? RecordSourceType.Auto;

    SetupConnectionString(report, oleDbConnectionString);

    await report.GenerateAsync();
    await report.RenderAsync();

    PdfFilter filter = new()
    Stream = new MemoryStream(),
    DocumentInfo = new DocumentInfo
    Author = "MANDO",
    CreationTime = DateTime.Now,
    RevisionTime = DateTime.Now,
    Creator = "MANDO",
    Title = toPdfFileName
    PageSettings = new C1PageSettings
    Landscape = false,
    PaperSize = PaperKind.A4
    FileName = toPdfFileName,
    PdfACompatible = true,
    Preview = true
    await report.RenderToFilterAsync(filter);
    return ((MemoryStream)filter.Stream).ToArray();
  • Replied 13 July 2022, 4:04 am EST

    We are investigating on this and update as we have an update on this.

    Manish Gupta
  • Replied 14 July 2022, 10:00 pm EST

    We are sorry for the inconvenience but we are unable to replicate the PDF on our end. Please refer to the attached sample for reference.

    Manish Gupta
  • Replied 18 July 2022, 2:44 am EST

    i checked the example and it works bug it was made in .Net Framework 4.8 while we are developing it on .NET CORE 6.0.

    I think there is a bug in the CORE 6.0 libraries

    Thank you, Regards, Marco Casaburi
  • Replied 18 July 2022, 3:15 am EST

    Here an example with correct references.
  • Replied 19 July 2022, 1:49 pm EST

    Thank you for reporting the issue. We are able to replicate it with Asp.Net core and it has been forwarded to the concerned team with the internal tracking id C1WEB-29217.

    We will let you know as we get an update on this.

    Manish Gupta
  • Replied 20 July 2022, 6:49 pm EST

    Hi Manish, I hope you treat this report with the highest priority. Badly exporting reports to PDF represents a very high criticality for the application.

    I am waiting for news,
    Marco Casaburi
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels