Multipage Tif viewer

S

SF

Folks,

I've been running into problems with a multipage Tif viewer that I wrote to
display fax images in an ASP.Net app. I've been basically following the
standard examples on how to do this:

- Read the image from a file
- set the current frame
- write the frame data to an output stream

and ended up with this code:

<snip>
System.Drawing.Image b;
System.Drawing.Imaging.FrameDimension frameDim;

//Read Tif from file (todo: change fromFile to stream)
strFilename = ConfigurationSettings.AppSettings["Images.Dir"] +
Request["filename"];
b = System.Drawing.Image.FromFile(strFilename);

//Set current frame
frameDim = new
System.Drawing.Imaging.FrameDimension(b.FrameDimensionsList[0]);
int intFrame = int.Parse(Request["frame"]);
b.SelectActiveFrame(frameDim,intFrame);

//Save to output stream in jpg format
Response.ContentType="image/jpeg";
b.Save(Response.OutputStream,System.Drawing.Imaging.ImageFormat.Jpeg);
b.Dispose();
</snip>

Now, this code works fine with Group 4 Tiff files. However, I am dealing
with Group 3 and here the application throws a "A generic error occurred in
GDI+."-exception whenever intFrame>0 (basically I can view the first page
and that's it). I saw other people in newsgroups having the same kind of
roblem but it never got resolved. Is this a bug in System.Drawing.Image? Is
there a patch or workaround for this?

Any advice/suggestions/code samples greatly appreciated.
Thanks
-Stefan

PS: If needed, I can supply an example Tif for both Group3/Group4 formats.
 
G

Guenther Liebowitz

I've been running into problems with a multipage Tif viewer that I wrote
to
display fax images in an ASP.Net app. I've been basically following the
standard examples on how to do this: ~snip~


Any advice/suggestions/code samples greatly appreciated.
Thanks


I would suggest that you consider using another technique that a friend of
mine uses when confronted with exactly the same issue. Whenever he runs into
this type of problem he locks himself in a closet and screams. Then he comes
out and still has the problem but at least he feels better.
Once you do that just change your code and your algorythim and all should
work nicely.
 
Y

Yan-Hong Huang[MSFT]

Hello Stefan,

Thanks for posting in the group.

After reviewing the problem description carefully, I think the exception should happen at line:
b.SelectActiveFrame(frameDim,intFrame);
If you transfer a >0 paramter to intFrame, the exception happens, right?

If so, it is related to GDI+ issue, not asp.net. I think you could create a simple windows form application and paste the same
code to see whether you could repro the problem or not. My suggestion for you is to post this question in framework.drawing
group. The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and
other partners who the newsgroups regularly can either share their knowledge or learn from your interaction with us.

When posting, it is better if you provide the following informatin:
1) Which OS? If windoes XP, please install windows XP SP1 first.
2) Which version of .NET framework are you using?
3) Could you use fax viewer to view all the pages of that TIff file successfully?

Thanks.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!From: "SF" <[email protected]>
!Subject: Multipage Tif viewer
!Date: Thu, 14 Aug 2003 13:09:19 -0700
!Lines: 49
!X-Priority: 3
!X-MSMail-Priority: Normal
!X-Newsreader: Microsoft Outlook Express 6.00.2720.3000
!X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
!Message-ID: <[email protected]>
!Newsgroups: microsoft.public.dotnet.framework.aspnet
!NNTP-Posting-Host: mx1.captaris.com 12.129.11.151
!Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:168051
!X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
!
!Folks,
!
!I've been running into problems with a multipage Tif viewer that I wrote to
!display fax images in an ASP.Net app. I've been basically following the
!standard examples on how to do this:
!
!- Read the image from a file
!- set the current frame
!- write the frame data to an output stream
!
! and ended up with this code:
!
!<snip>
! System.Drawing.Image b;
! System.Drawing.Imaging.FrameDimension frameDim;
!
! //Read Tif from file (todo: change fromFile to stream)
! strFilename = ConfigurationSettings.AppSettings["Images.Dir"] +
!Request["filename"];
! b = System.Drawing.Image.FromFile(strFilename);
!
! //Set current frame
! frameDim = new
!System.Drawing.Imaging.FrameDimension(b.FrameDimensionsList[0]);
! int intFrame = int.Parse(Request["frame"]);
! b.SelectActiveFrame(frameDim,intFrame);
!
! //Save to output stream in jpg format
! Response.ContentType="image/jpeg";
! b.Save(Response.OutputStream,System.Drawing.Imaging.ImageFormat.Jpeg);
! b.Dispose();
!</snip>
!
!Now, this code works fine with Group 4 Tiff files. However, I am dealing
!with Group 3 and here the application throws a "A generic error occurred in
!GDI+."-exception whenever intFrame>0 (basically I can view the first page
!and that's it). I saw other people in newsgroups having the same kind of
!roblem but it never got resolved. Is this a bug in System.Drawing.Image? Is
!there a patch or workaround for this?
!
!Any advice/suggestions/code samples greatly appreciated.
!Thanks
!-Stefan
!
!PS: If needed, I can supply an example Tif for both Group3/Group4 formats.
!
!
!
!
!
 
S

SF

Thanks, Yanhong, you nailed it!

Yan-Hong Huang said:
Hello Stefan,

Thanks for posting in the group.

After reviewing the problem description carefully, I think the exception should happen at line:
b.SelectActiveFrame(frameDim,intFrame);
If you transfer a >0 paramter to intFrame, the exception happens, right?

If so, it is related to GDI+ issue, not asp.net. I think you could create
a simple windows form application and paste the same
code to see whether you could repro the problem or not. My suggestion for
you is to post this question in framework.drawing
group. The reason why we recommend posting appropriately is you will get
the most qualified pool of respondents, and
other partners who the newsgroups regularly can either share their
knowledge or learn from your interaction with us.
When posting, it is better if you provide the following informatin:
1) Which OS? If windoes XP, please install windows XP SP1 first.
2) Which version of .NET framework are you using?
3) Could you use fax viewer to view all the pages of that TIff file successfully?

Thanks.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!From: "SF" <[email protected]>
!Subject: Multipage Tif viewer
!Date: Thu, 14 Aug 2003 13:09:19 -0700
!Lines: 49
!X-Priority: 3
!X-MSMail-Priority: Normal
!X-Newsreader: Microsoft Outlook Express 6.00.2720.3000
!X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
!Message-ID: <[email protected]>
!Newsgroups: microsoft.public.dotnet.framework.aspnet
!NNTP-Posting-Host: mx1.captaris.com 12.129.11.151
!Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:168051
!X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
!
!Folks,
!
!I've been running into problems with a multipage Tif viewer that I wrote to
!display fax images in an ASP.Net app. I've been basically following the
!standard examples on how to do this:
!
!- Read the image from a file
!- set the current frame
!- write the frame data to an output stream
!
! and ended up with this code:
!
!<snip>
! System.Drawing.Image b;
! System.Drawing.Imaging.FrameDimension frameDim;
!
! //Read Tif from file (todo: change fromFile to stream)
! strFilename = ConfigurationSettings.AppSettings["Images.Dir"] +
!Request["filename"];
! b = System.Drawing.Image.FromFile(strFilename);
!
! //Set current frame
! frameDim = new
!System.Drawing.Imaging.FrameDimension(b.FrameDimensionsList[0]);
! int intFrame = int.Parse(Request["frame"]);
! b.SelectActiveFrame(frameDim,intFrame);
!
! //Save to output stream in jpg format
! Response.ContentType="image/jpeg";
! b.Save(Response.OutputStream,System.Drawing.Imaging.ImageFormat.Jpeg);
! b.Dispose();
!</snip>
!
!Now, this code works fine with Group 4 Tiff files. However, I am dealing
!with Group 3 and here the application throws a "A generic error occurred in
!GDI+."-exception whenever intFrame>0 (basically I can view the first page
!and that's it). I saw other people in newsgroups having the same kind of
!roblem but it never got resolved. Is this a bug in System.Drawing.Image? Is
!there a patch or workaround for this?
!
!Any advice/suggestions/code samples greatly appreciated.
!Thanks
!-Stefan
!
!PS: If needed, I can supply an example Tif for both Group3/Group4 formats.
!
!
!
!
!
 
Joined
Mar 16, 2009
Messages
1
Reaction score
0
ASP.NET Multipage TIFF file Viewer

If you are looking for asp.net multipage tiff viewer then try our asp.net thumbnail tif control, we have three versions of control. First is C# vb.net winforms tiff viewer, second is browser based tiff viewer and third is silverlight tiff viewer control. You can easily integrate them within your existing windows or web based application.

tiffviewer.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top