将GIF转换为PDF byte []

时间:2013-04-04 12:05:40

标签: c# asp.net-mvc

我正在呼叫第三方网络服务,它返回一个GIF。我想将该图像转换为PDF,然后我想将其转换为byte[]

这是我的代码:

 HttpWebRequest NxtserviceRequest = (HttpWebRequest)WebRequest.Create(ImgPath);
 NxtserviceRequest.Method = "GET";
 HttpWebResponse NxtServiceResponse = (HttpWebResponse)NxtserviceRequest.GetResponse();

 Stream NxtresponseStream;
 NxtresponseStream = NxtServiceResponse.GetResponseStream();

 using (MemoryStream ms = new MemoryStream())
 {
      int count = 0;
      do
      {
           byte[] buf = new byte[1024];
           count = NxtresponseStream.Read(buf, 0, 1024);
           ms.Write(buf, 0, count);
      } while (NxtresponseStream.CanRead && count > 0);

      binaryData = ms.ToArray();
      ...
 }

当我尝试在文件浏览器上传递此binaryData时,它在PDF生成时显示错误。

0 个答案:

没有答案