开发者

How do I display a PDF?

开发者 https://www.devze.com 2023-02-11 11:47 出处:网络
I have tried to display a PDF file by using a WebView using the following code - webview.loadUrl(\"http://www.mywebsite.co.uk/floorplan.pdf\");

I have tried to display a PDF file by using a WebView using the following code -

webview.loadUrl("http://www.mywebsite.co.uk/floorplan.pdf");  

or

Uri uri = Uri.parse("http://www.mywebsite.co.uk/floorplan.pdf");    
Intent intent = new Intent(Intent.ACTION_VIEW, uri);  
startActivity(intent);  

Using either I cannot get the PDF to display unless I run it开发者_开发问答 through Adobe (so my app is downloading it), which then looks fine. How can I get the PDF to display using Adobe through my app or am I better off displaying the PDF as an image instead?


You'd have to build a pdf viewer to display it inside your app. Your best best is to launch the Intent like you are doing to display it in an external pdf viewer.

Check out this question for more.

Show PDF in Android

0

精彩评论

暂无评论...
验证码 换一张
取 消