Results 1 to 2 of 2

Thread: iTextSharp image.getinstance issue

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2000
    Location
    Minnesota
    Posts
    830

    iTextSharp image.getinstance issue

    Can anyone tell me why the first instance errors while the second doesn't?

    SITUATION 1:
    imgItem = Image.GetInstance(New Uri("https://www.domain1.com/index_im.cfm?ItemNumberP=AA0220-YE&BM=Y"))

    ERROR RETURNED:
    System.IO.IOException: https://www.domain1.com/index_im.cfm...AA0220-YE&BM=Y is not a recognized imageformat.
    at iTextSharp.text.Image.GetInstance(Uri url) at asf_view_cart.btnCreatePDF_Click(Object sender, EventArgs e)

    SITUATION 2:
    imgItem = Image.GetInstance(New Uri("http://www.domain1.com/images/item-image.jpg"))

    RETURNS WITH NO ERRORS

    Any thoughts on how to get the first url to work?

    I believe I am using iTextSharp 5.1 (or whatever the latest is)

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: iTextSharp image.getinstance issue

    Hello,

    There are a couple things that could be going on here.

    First up, the first link uses SSL, notice the https, which could be causing problems.

    Secondly, the first link doesn't actually link to an image, but rather some form of "handler" for an image. The second links directly to a file, i.e. .jpg. It might be the case that you have to first read the bytes from the URL, and then pass them into iTextSharp.

    Gary

Posting Permissions

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



Click Here to Expand Forum to Full Width