Professional Web Applications Themes

Multipage Tif viewer - ASP.NET General

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.FrameDimen sionsList[0]); int intFrame = int.P(Request["frame"]); b.SelectActiveFrame(frameDim,intFrame); //Save to output stream ...

  1. #1

    Default Multipage Tif viewer

    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.FrameDimen sionsList[0]);
    int intFrame = int.P(Request["frame"]);
    b.SelectActiveFrame(frameDim,intFrame);

    //Save to output stream in jpg format
    Response.ContentType="image/jpeg";
    b.Save(Response.OutputStream,System.Drawing.Imagin g.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.




    SF Guest

  2. #2

    Default Re: Multipage Tif viewer

    > I've been running into problems with a multipage Tif viewer that I wrote
    to 
    ~snip~

     


    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.



    Guenther Guest

  3. #3

    Default RE: Multipage Tif viewer

    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" <com>
    !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: <Oe7Pz$phx.gbl>
    !Newsgroups: microsoft.public.dotnet.framework.aspnet
    !NNTP-Posting-Host: mx1.captaris.com 12.129.11.151
    !Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP09.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.FrameDime nsionsList[0]);
    ! int intFrame = int.P(Request["frame"]);
    ! b.SelectActiveFrame(frameDim,intFrame);
    !
    ! //Save to output stream in jpg format
    ! Response.ContentType="image/jpeg";
    ! b.Save(Response.OutputStream,System.Drawing.Imagin g.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.
    !
    !
    !
    !
    !


    Yan-Hong Guest

  4. #4

    Default Re: Multipage Tif viewer

    Thanks, Yanhong, you nailed it!

    "Yan-Hong Huang[MSFT]" <microsoft.com> wrote in message
    news:phx.gbl... 
    should happen at line: 
    a simple windows form application and paste the same 
    you is to post this question in framework.drawing 
    the most qualified pool of respondents, and 
    knowledge or learn from your interaction with us. 
    successfully? 
    rights. 
    microsoft.public.dotnet.framework.aspnet:168051 
    to 
    b.Save(Response.OutputStream,System.Drawing.Imagin g.ImageFormat.Jpeg); 
    in 
    Is 
    formats. 


    SF Guest

Similar Threads

  1. Multipage PDF with Acrobat 8.0
    By erahul_ag@adobeforums.com in forum Adobe Acrobat SDK
    Replies: 0
    Last Post: February 15th, 05:35 AM
  2. multipage form
    By dorrie in forum Macromedia Dynamic HTML
    Replies: 2
    Last Post: May 2nd, 05:31 PM
  3. Multipage layout
    By Ludger in forum Macromedia Freehand
    Replies: 4
    Last Post: August 30th, 07:54 PM
  4. Dynamic tabstrip and multipage
    By Elad Frid in forum ASP.NET Building Controls
    Replies: 2
    Last Post: May 3rd, 07:09 AM
  5. multipage pdf import
    By Thomas_Ellefson@adobeforums.com in forum Adobe Indesign Windows
    Replies: 2
    Last Post: April 23rd, 09:23 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139