Hello,
First, my goal is to take a report and convert it to a image. To that end I found some sample code (shown below) which does that
The code creates a jpeg, but only the first page is rendered. Is this code incomplete?
Scott
Report1 report1 = new Report1();
string mimType = string.Empty;
string extension = string.Empty;
Encoding encoding = null;
try
{
Hashtable deviceInfo = new Hashtable();
deviceInfo["OutputFormat"] = "JPEG";
byte[] buffer = Telerik.Reporting.Processing.ReportProcessor.Render(
"IMAGE", report1, deviceInfo, out mimType, out extension, out encoding);
using (MemoryStream stream = new MemoryStream(buffer))
{
using (Image img = Image.FromStream(stream))
{
img.Save(@"c:\" + report1.GetType().Name + "." + extension,
System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
First, my goal is to take a report and convert it to a image. To that end I found some sample code (shown below) which does that
The code creates a jpeg, but only the first page is rendered. Is this code incomplete?
Scott
Report1 report1 = new Report1();
string mimType = string.Empty;
string extension = string.Empty;
Encoding encoding = null;
try
{
Hashtable deviceInfo = new Hashtable();
deviceInfo["OutputFormat"] = "JPEG";
byte[] buffer = Telerik.Reporting.Processing.ReportProcessor.Render(
"IMAGE", report1, deviceInfo, out mimType, out extension, out encoding);
using (MemoryStream stream = new MemoryStream(buffer))
{
using (Image img = Image.FromStream(stream))
{
img.Save(@"c:\" + report1.GetType().Name + "." + extension,
System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}