cmkrnl
cmkrnl

Reputation: 11

Displaying multi-page/frame TIFF file in ASP.Net 2.0

I'm trying to display a multi-page/frame TIFF file on a web page. All I get displayed is the first page.
I can also display any single page in the mutli-page file using SetActiveFrame to select the appropriate page. I just can't display the entire file.
My code:

Response.ContentType = "image/jpeg";
Image image = Image.FromFile("MyTiff.tif");
int frameCount = image.GetFrameCount(Imaging.FrameDimension.Page);
for (int index = 0; index < frameCount; index++)
{
    image.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Page, index);
    image.Save(Response.OutputStream, Imaging.ImageFormat.Jpeg);
} 

I also tried making each page a separate image in a collection of images, to completely disassociate each image from the TIFF file, and then saving the collection of images to the web page. This also resulted in only the first image being displayed on the web page.

Thanks

Upvotes: 0

Views: 2280

Answers (1)

cmkrnl
cmkrnl

Reputation: 11

I finally solved the problem by using Pdfsharp from http://www.pdfsharp.net. It allowed me to convert the tif file to a pdf document which I then displayed.

Upvotes: 1

Related Questions