Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
135
Add bookmarks to Infragistics Report programmatically
posted

I am developing a small POC to display the capabilities of the Infragistics reporting libraries to my team.  So far, I have created an Infragistics Report (.igr) and bound it to a data source.  I then "export" it to PDF via response stream (see code below).  I understand that the Infragistics Report can be exported in several formats, but I have some team members who want the capability to add bookmarks to these PDF exports.  Is there a way to do this with the Infragistics Report or am I going about this the wrong way?  I have seen some examples of creating the reports entirely in code, but, if bookmarks cannot be added to the Infragistics Report, then it would be nice to pull in the Infragistics Report object and then modify it programmatically.

Any help or links would be greatly appreciated!

 

 Code:

 

protected void Button1_Click(object sender, EventArgs e)

{

            var reportUri = new Uri("Reports/ItemList.igr", UriKind.Relative);

            using (var exporter = ServerExporterFactory.CreateExporter(reportUri))

            {

                        var memoryStream = new MemoryStream();

                        exporter.Export(memoryStream, "PDF");

                        SendStreamToResponse(memoryStream, "Report1.pdf", "application/pdf");

                        memoryStream.Close();

            }

}

 

private void SendStreamToResponse(MemoryStream stream, string fileName, string contentType)

{

            var reportBuffer = stream.ToArray();

            Response.AddHeader("Content-Length", reportBuffer.Length.ToString());

            Response.ContentType = contentType;

            Response.AddHeader("Expires", "0");

            Response.AddHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");

            Response.AddHeader("Pragma", "public");

            Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);

            Response.BinaryWrite(reportBuffer);

            Response.Flush();

            Response.End();

}