Google Docs Link and Viewing PDF
https://spreadsheets.google.com/spreadsheet/pub?key=0Ap6NKDUcJz8sdHZjOWM1bkFxZ0wxUW9Bcnl3QmRsbGc&single=true&gid=0&output=pdf
The link above downloads the PDF, but I jus开发者_如何学Pythont want it to open up in the browser. Is there a way to do this?
Remove the output=pdf.
https://spreadsheets.google.com/spreadsheet/pub?key=0Ap6NKDUcJz8sdHZjOWM1bkFxZ0wxUW9Bcnl3QmRsbGc&single=true&gid=0
If you want to open pdf in browser without downloading pdf then below is the best way to do it :
Intent i = new Intent(Intent.ACTION_VIEW);
String yoururl = https://spreadsheets.google.com/spreadsheet/pub?key=0Ap6NKDUcJz8sdHZjOWM1bkFxZ0wxUW9Bcnl3QmRsbGc&single=true&gid=0&output=pdf;
yoururl= "https://drive.google.com/viewerng/viewer?embedded=true&url=" + yoururl;
i.setData(Uri.parse(yoururl));
startActivity(i);
If you want it to open in your browser, you need a PDF viewing plugin for your browser. The same obviously holds true for your visitors as well. It is the browser which determines what to do with files. (open or dowload)
精彩评论