473,803 Members | 2,909 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multipage Tif viewer

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.FrameDi mension frameDim;

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

//Set current frame
frameDim = new
System.Drawing. Imaging.FrameDi mension(b.Frame DimensionsList[0]);
int intFrame = int.Parse(Reque st["frame"]);
b.SelectActiveF rame(frameDim,i ntFrame);

//Save to output stream in jpg format
Response.Conten tType="image/jpeg";
b.Save(Response .OutputStream,S ystem.Drawing.I maging.ImageFor mat.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.


Nov 17 '05 #1
3 2609
> 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.

Nov 17 '05 #2
Hello Stefan,

Thanks for posting in the group.

After reviewing the problem description carefully, I think the exception should happen at line:
b.SelectActiveF rame(frameDim,i ntFrame);
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.drawi ng
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" <st************ ****@captaris.c om>
!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: <Oe************ **@TK2MSFTNGP09 .phx.gbl>
!Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
!NNTP-Posting-Host: mx1.captaris.co m 12.129.11.151
!Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP09.phx.g bl
!Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1680 51
!X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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.FrameDi mension frameDim;
!
! //Read Tif from file (todo: change fromFile to stream)
! strFilename = ConfigurationSe ttings.AppSetti ngs["Images.Dir "] +
!Request["filename"];
! b = System.Drawing. Image.FromFile( strFilename);
!
! //Set current frame
! frameDim = new
!System.Drawing .Imaging.FrameD imension(b.Fram eDimensionsList[0]);
! int intFrame = int.Parse(Reque st["frame"]);
! b.SelectActiveF rame(frameDim,i ntFrame);
!
! //Save to output stream in jpg format
! Response.Conten tType="image/jpeg";
! b.Save(Response .OutputStream,S ystem.Drawing.I maging.ImageFor mat.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.
!
!
!
!
!
Nov 17 '05 #3
SF
Thanks, Yanhong, you nailed it!

"Yan-Hong Huang[MSFT]" <yh*****@online .microsoft.com> wrote in message
news:WV******** ******@cpmsftng xa06.phx.gbl...
Hello Stefan,

Thanks for posting in the group.

After reviewing the problem description carefully, I think the exception should happen at line: b.SelectActiveF rame(frameDim,i ntFrame);
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.drawi ng 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" <st************ ****@captaris.c om>
!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: <Oe************ **@TK2MSFTNGP09 .phx.gbl>
!Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
!NNTP-Posting-Host: mx1.captaris.co m 12.129.11.151
!Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP09.phx.g bl
!Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1680 51 !X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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.FrameDi mension frameDim;
!
! //Read Tif from file (todo: change fromFile to stream)
! strFilename = ConfigurationSe ttings.AppSetti ngs["Images.Dir "] +
!Request["filename"];
! b = System.Drawing. Image.FromFile( strFilename);
!
! //Set current frame
! frameDim = new
!System.Drawing .Imaging.FrameD imension(b.Fram eDimensionsList[0]);
! int intFrame = int.Parse(Reque st["frame"]);
! b.SelectActiveF rame(frameDim,i ntFrame);
!
! //Save to output stream in jpg format
! Response.Conten tType="image/jpeg";
! b.Save(Response .OutputStream,S ystem.Drawing.I maging.ImageFor mat.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. !
!
!
!
!

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2424
by: news.microsoft.com | last post by:
Hello group, My goal is to attach an image over another image. Top image should be transparent so the back image is visible through the top one. Bellow is a test code in VB.NET. You need to create a form, a button (Button1) and an Picture Box (picBox). "watermark.jpg" is any jpg image, "beispiel.tif" is a multipage TIFF image with the white background, which will turn to transparent. The most important thing here is that the TIFF image...
0
1171
by: T.H.M | last post by:
Hello I have a web form with MultiPage that contain DataGrid My HTML code in the aspx page: <iewc:multipage id="MP1" style="Z-INDEX: 101; LEFT: 225px; POSITION: . . ."/> >iewc:PageView id="processData1/"> >asp:DataGrid id="DG2" style="Z-INDEX: 110; LEFT: 699px; POSITION: absolute; TOP: 379px" unat="server"> </asp:DataGrid<
2
1539
by: T.H.M | last post by:
Hello I have a web form with MultiPage that contain DataGrid My HTML code in the aspx page: <iewc:multipage id="MP1" style="Z-INDEX: 101; LEFT: 225px; POSITION: . . ."/> >iewc:PageView id="processData1/"> >asp:DataGrid id="DG2" style="Z-INDEX: 110; LEFT: 699px; POSITION: absolute; TOP: 379px" unat="server"> </asp:DataGrid<
1
1550
by: szabelin | last post by:
Is it possible to dynamically add a PageView to MultiPage? TabStrip has items property, so Tab and TabSeparator can be added... how about adding PageView to MultiPage? If not possible please recommend another client-side tab control. Thank you
1
2244
by: Dan | last post by:
IE WebControls Tab/MultiPage state problem I have a IE tab/multipage on a WebForm (aspx) like this: <code> <iewc:TabStrip id="tabs" runat="server" TargetID="MultiPage1"> <iewc:Tab Text="Tab1" ID="tp Tab1"></iewc:Tab>
2
2544
by: Child | last post by:
I have a page which has a tabbstrip and a multipage. The tab strip works great, and navigates the multipage no problem. However, I have a situation where I would like to have a "hidden" multipage thats not navigated to via the tabstrip and I am running into trouble. i see that supposedly I can do this with multipage.selectedindex = myindex but that doesnt' appear to work for me. I was wondering if I could use both the tabstrip and...
1
1335
by: suresh | last post by:
Thanks Patrice. But I want to navigate between the pages of a multi-paged tiff image displayed on the client browser rather than displaying multiple tiff images on a page. Thanks Suresh
1
4894
by: Ira | last post by:
I was successful in creating the multipage Tif files in VB.net using the following the following code: Public Sub SaveSeveralOnePageFilesInADir(ByVal DrNm As String, ByVal resultFl As String) Dim pages As Bitmap = Nothing Dim PgCnt As Integer
4
2311
by: shaiful | last post by:
Hi. I have a simple problem with multipage. I placed Multipage control on my form, but there are only 2 pages in multipage control by default. I would like to increase more pages with multipage option. I tried to set Multipage1.value = 3, but it says Error. I am using vb 6.0. So what is the process or method? Could you please help me to give idea about this small problem? Thanks in advance, Shaiful
0
9699
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10542
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10309
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10068
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7600
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5496
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4274
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3795
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.