Telerik Reporting to generate pdf is generating empty pdf RRS feed

  • Question

  • User-85150645 posted

    This is my code that gets data from DB as data table and creates telerik repost which is then used to create a pdf. But it generates only empty pdf. Am i doing anything incorrect?..Please help me in this.

    PersonDetails PersonDetails = new PersonDetails();
    DataTable table = PersonDetails.GetPersonDetails();

    //test source
    List<PersonDetails> dataList = PersonDetails.RenderPersonDetails();

    // Creating a new report
    Telerik.Reporting.Report report = new Telerik.Reporting.Report();

    // Assigning the ObjectDataSource component to the DataSource property of the report.
    report.DataSource = "sam is a developer";

    Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource();
    instanceReportSource.ReportDocument = report;

    ReportProcessor reportProcessor = new ReportProcessor();
    RenderingResult result = reportProcessor.RenderReport("PDF", report, null);
    using (FileStream fs = new FileStream(@"C:\Sam's Clipboard\MyReport.pdf", FileMode.Create))
    fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);


    Sam Azpan. D

    Monday, August 10, 2015 2:56 AM

All replies

  • User-219423983 posted

    Hi Sam Azpan,

    Welcome to ASP.NET Forums.

    First of all, you should debug step by step to make sure the object “report” is not null.

    Then, according to the following demo, I think you could should replace

    RenderingResult result = reportProcessor.RenderReport("PDF", report, null);


    RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, null);

    and then try again.


    I hope it’s useful to you.

    Best Regards,

    Weibo Zhang

    Tuesday, August 11, 2015 9:40 AM