PDF下载失败的Andr​​oid浏览器

PDF下载失败的Andr​​oid浏览器

本文介绍了PDF下载失败的Andr​​oid浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.Net Web窗体动态生成的PDF文件。 PDF格式下载适用于所有的桌面浏览器,以及在iPad,手机浏览器和Firefox移动。但是,PDF格式下载失败的Andr​​oid浏览器,在通知区域显示下载失败。我写的PDF与此code响应:

I have an ASP.Net WebForm that dynamically generates a pdf. The pdf download works in all the desktop browsers, as well as the IPad, Chrome mobile, and Firefox mobile. However, the pdf download fails in the Android browser with the message "Download Unsuccessful" in the notification area. I am writing the pdf to the response with this code:

using (PdfDocument pdf = this.RenderPDF())
using (MemoryStream stream = new MemoryStream())
{
    pdf.Save(stream, false);
    response.Clear();
    response.AddHeader("content-disposition", "inline;filename=myPdf.pdf");
    response.AddHeader("content-length", stream.Length.ToString());
    response.ContentType = "application/pdf";
    response.BinaryWrite(stream.ToArray());
    response.Flush();
    stream.Close();
    response.End();
}

我应该做的不同,以获取PDF下载在Android浏览器中正常工作?

What should I do differently to get the pdf download working in the Android browser?

推荐答案

,我猜想这是在响应POST。我有同样的问题,并找到! - 开放自2009年以来

The issue referenced is Support download of POST responses - open since 2009!

(这个问题有几个迭代的S / O;也不收,也不回答所有这些似乎是合理的,因此如何对一些链接:

(This question has several iterations on S/O; neither closing nor answering them all seems reasonable, so how about some links:

  • C#响应显示下载的Andr​​oid浏览器
  • 不成功的错误
  • C#回复于PDF工作不与Android的浏览器
  • ASP.NET不一致的PDF文件下载结果)
  • C# Response Shows Download Unsuccessful Error on Android Browser
  • C# Response.Write pdf not working with Android Browser
  • ASP.NET Inconsistent PDF file download results )

这篇关于PDF下载失败的Andr​​oid浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 20:35