The Webview does not display PDF

Umakant Sharma 0 Reputation points
2024-12-16T13:31:29.8466667+00:00

iOS is displaying pdf but android WebView does nothing.

I want to open a pdf from a web resource on WebView. But the WebView does not render the pdf. On the other hand the webpages are displayed on WebView without any problem.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,807 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 69,121 Reputation points
    2024-12-16T17:07:57.91+00:00

    while IOS has builtin pdf support, android does not. typically you would use a javascript pdf viewer hosted in the webview.

    https://github.com/mozilla/pdf.js/


  2. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 46,821 Reputation points Microsoft Vendor
    2024-12-18T06:00:04.4433333+00:00

    Hello,

    As Bruce mentioned, Android's native WebView does not support direct viewing of PDFs. You can refer to the detailed steps in this thread on how to set up Android Webivew to view PDFs.

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.