2016-04-14 7 views
1

私はC#ASP.NET Webアプリケーションを開発中です。 PDF文書を開くハイパーリンクを作成しました。 PDF文書をブラウザでインラインで開く必要があります。デスクトップ上のChromeでは正常に動作します。アンドロイド上のChromeでは、PDFドキュメントをダウンロードします。両方のデバイスでPDFをインラインで開くように修正するにはどうすればよいですか?クロムアンドロイドでPDF文書のインライン展開を強制するには?

これは私のコードです:

var document = sessionManager.DocumentServiceClient.GetDocument(documentId, documentStorageType); 

this.Response.Clear(); 
this.Response.ContentType = "application/pdf"; 
this.Response.AddHeader("Content-Disposition", string.Format("inline; filename = \"{0}.pdf\"", this.DocumentTitle)); 
this.Response.OutputStream.Write(document.FileData, 0, document.FileData.Length); 
this.Response.End(); 
+0

可能な重複[最初にダウンロードしないでAndroidウェブブラウザ経由でPDFを表示する方法](http://stackoverflow.com/questions/7437602/how-to-display-a-pdf-via) -android-web-browser-without-downloading-first) – JimmyB

+0

解決策はありません。私の質問は同じではないと思います。 – Jax

答えて

0

修正プログラムはこのContentTypeをを使用していた:

this.Response.ContentType = "application/octet-stream"; 

また、ファイル名にスペースを削除するために必要だった。

this.Response.AddHeader("Content-Disposition", string.Format("inline; filename = \"{0}.pdf\"", this.DocumentTitle.Replace(" ",""))); 
関連する問題