I am trying to display a multi-page .tif image in a telerik report. The image is displaying, however, I can only see the first page of the image.
Is there a way to display the entire .tif image in the report?
Thanks for your help. Mike
1 Answer, 1 is accepted
0
Steve
Telerik team
answered on 05 Oct 2012, 11:31 AM
Hi Mike,
Your inquiry is unusual for a reporting product as showing multiple pages of a tiff file inside a report does not fit well in the template structure of a report. Moreover, the question itself is not directly related to the product and does not fall in our support domain.
Still it can be accomplished with some code, by iterating through the collection of pages, saving them in memory and setting them as value for a PictureBox item. Here is a sample code snippet that you can modify to best fit your needs:
int pageCount = image.GetFrameCount(FrameDimension.Page);
int i = 0;
Unit unitX = Unit.Inch(0.1);
Unit unitY = Unit.Inch(0.1);
SizeU size = new SizeU(Unit.Inch(1), Unit.Inch(0.5));
for (int y = 0; y < pageCount; y++)
{
//save each frame to a bytestream
image.SelectActiveFrame(FrameDimension.Page, y);
MemoryStream byteStream = new MemoryStream();
image.Save(byteStream, ImageFormat.Png);
//create a new pictureBox and set its value to the bytestream
Telerik.Reporting.PictureBox pic = new Telerik.Reporting.PictureBox();
pic.Location = new PointU(unitX, unitY);
pic.Size = size;
unitY = unitY.Add(Unit.Inch(0.5));
pic.Sizing = ImageSizeMode.AutoSize;
pic.Style.BorderStyle.Default = BorderType.Solid;
pic.Style.BorderColor.Default = Color.Black;
pic.Value = Image.FromStream(byteStream);
pic.Name = "pictureBox" + i;
this.detail.Items.Add(pic);
i++;
}
Kind regards,
Steve
the Telerik team
HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!