I am developing an android application in which I tried to load pdf into Webview from the URL mentioned below,
http://ipAddress/SD_BIO/showDocument.jsp?fileName=HIPAA%20Authorization%20Form.pdf&attachmentType=STUDY_INFORMED_CONSENT_FORMS&attachmentTypeId=120&documentId=412
I tried in the following ways ,
((WebView) findViewById(R.id.pdf)).getSettings().setJavaScriptEnabled(
true);
((WebView) findViewById(R.id.pdf)).getSettings().setAllowFileAccess(
true);
((WebView) findViewById(R.id.pdf)).getSettings().setPluginState(
PluginState.ON);
((WebView) findViewById(R.id.pdf))
.loadUrl("http://ipAddress/SD_BIO/showDocument.jsp?fileName=HIPAA%20Authorization%20Form.pdf&attachmentType=STUDY_INFORMED_CONSENT_FORMS&attachmentTypeId=120&documentId=412");
The Webview is loaded , but encrypted like below,
Then I modified the loadURL
like below,
((WebView) findViewById(R.id.pdf))
.loadUrl("http://docs.google.com/gview?embedded=true&url=http://ipAddress1/SD_BIO/showDocument.jsp?fileName=HIPAA%20Authorization%20Form.pdf&attachmentType=STUDY_INFORMED_CONSENT_FORMS&attachmentTypeId=120&documentId=412");
But,it shows "No Preview Available" . Also,I could able to see some thirdparty libraries.But,client does not want any third party libraries .
Please help me find the solution .
WebView
does not show PDF files. If http://ipAddress/SD_BIO/showDocument.jsp
is returning a PDF file, WebView
has no means of displaying it.
But,client does not want any third party libraries .
Your client does not have very many options:
Use third-party PDF rendering code.
Use a third-party PDF viewer app.
Serve up something other than PDF, such as HTML.
On Android 5.1+, try PdfRenderer
, though that is really designed for print previews.
Hire developers to write a custom PDF renderer from scratch (hundreds of developer-months' worth of work).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.