将图像作为http响应发送

时间:2011-10-10 16:42:17

标签: .net

我从URL链接(这是pdf文件的链接)下载字节

WebClient imageWebClient = new WebClient();
response.Image = imageWebClient.DownloadData(Url);

对于我正在做的其他图像类型,我不知道我应该如何显示从pdf文件中提取的图像。

context.Response.AddHeader("Content-Disposition", "inline;  filename=image.jpg");
                            context.Response.ContentType = "image/jpeg";

streamBitmap = new MemoryStream(response.Image);  //GetBitMapStreamFromData(CheckImg.ImageData);
if (streamBitmap != null)
{
    streamBitmap.WriteTo(context.Response.OutputStream);
}

这不适用于上述代码从pdf链接收到的字节。

0 个答案:

没有答案
相关问题