How to display a PDF via Android web browser without "downloading" first

Solution 1:

You can open a file PDF in Google Docs Viewer by appending the URL to:

http://docs.google.com/gview?embedded=true&url=<URL of a supported doc>

This would open a PDF file in the default browser or a WebView.

A list of supported formats is given here.

Solution 2:

You can use this format as of 2017-04-06.

https://docs.google.com/viewerng/viewer?url=http://yourfile.pdf

Just replace http://yourfile.pdf with the link you use.

Solution 3:

String format = "https://drive.google.com/viewerng/viewer?embedded=true&url=%s";
String fullPath = String.format(Locale.ENGLISH, format, "PDF_URL_HERE");
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(fullPath));
startActivity(browserIntent);

Solution 4:

Specifically, to install the pdf.js plugin for Firefox, you do not use the app store. Instead, go to addons.mozilla.org from inside Mozilla and install it from there.

Also, to see if it's installed properly, go to the menu ToolsAdd-ons (not the "about:plugins" URL as you might think from the desktop version).