How can a multi-page PDF file be created? RRS feed

  • Question

  • I am currently able to create a PDF file with the following code:

    ReportDataSource dataSource = new ReportDataSource("<dataSetName>", <collection of business objects>);
    ReportViewer viewer = new ReportViewer();
    viewer.ProcessingMode = ProcessingMode.Local;
    viewer.LocalReport.ReportPath = reportPath;
    byte[] bytes = viewer.LocalReport.Render("PDF");
    Response.ContentType = "application/pdf";
    Response.BufferOutput = true;
    Response.AddHeader("content-disposition", "attachment; filename=<fileName>.pdf");

    My <collection of business objects> currently contains one item that is used to set the data on the .RDLC file. 

    Is it possible to create a PDF file with multiple pages by using the same .RDLC file? 

    For example:

    If my <collection of business objects> contained 3 items.  I would like to create a PDF file containing 3 pages.  Each page would use the same RDLC file representing an item in the <collection of business objects>. 

    Wednesday, September 5, 2012 8:54 PM