locked
Multiple Page RDLC to Image RRS feed

  • Question

  • User-2069879592 posted

    I am able to export rdlc to Image, but it exports only the first page.Below is the code:

     private void sendImage(ReportViewer reportViewer)
        {
            Warning[] warnings;
            string[] streamids;
            string encoding;
            string extension;
            string mimeType = "image/tiff";
            string deviceInfo = "<DeviceInfo><OutputFormat>TIFF</OutputFormat><StartPage>0</StartPage></DeviceInfo>";
            byte[] byts = null;
            byts = reportViewer.LocalReport.Render("Image", deviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings);
            string path = Server.MapPath("~/Proposals") + "/" + txtEstimateNo.Text + ".tif";
            File.WriteAllBytes(path, byts);
        }

    Thanks,

    Bala

    Thursday, February 13, 2014 12:11 AM

Answers

  • User1140095199 posted

    Hi,

    I am able to export rdlc to Image, but it exports only the first page.Below is the code:

    The above code simply converts the first page to Image. There is no code to traverse through the pages, nor a List that could hold the reference of which page you are in and how many pages are there.

    There is a need to create a List and int to keep a track on the number of pages.

    private int m_currentPageIndex;
    private IList<Stream> m_streams;
    
    .....
    .....
    .....
    //Inside the sendImage method
    Warning[] warnings;
    m_streams = new List<Stream>();
    report.Render("Image", deviceInfo, CreateStream,
    out warnings);
    foreach (Stream stream in m_streams)
    stream.Position = 0;
    
    }

    Refer to the following link -http://msdn.microsoft.com/en-us/library/ms252091.aspx
    The above link has complete code reference that can be modified and used.

    Hope it helps!

    Best Regards!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 13, 2014 10:34 PM