itext - iTextSharp add image from route -


i'm trying retrieve image in itextsharp. image retrieved calling: local.myapp.com/file/filedownload/102737. images in database , filedownload actionresult method gets image according id provided.

i'm trying call above url c# class (not controller) this

itextsharp.text.image.getinstance(httpcontext.current.server.mappath($"{imgname}")); 

however i'm not able make work. wrong path beginning with: c:\windows\system32\inetsrv\

as discussed in comments question, image

has retrieved through http.

thus, instead of using image.getinstance overload string argument (which assumes argument file name in local file system), use overload uri argument:

    /// <summary>     /// gets instance of image.     /// </summary>     /// <param name="url">an url</param>     /// <returns>an object of type gif, jpeg or png</returns>     public static image getinstance(uri url) 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -