0

Since last month I have been searching for best way to show pdf into android app. I was always getting help of third party library. No one has talked about Android also providing same thing via PdfRenderer. If we have native support, why should we use library?

Please correct me, Why on search to show pdf file into Android app, I am always getting link of libs?

Rohan Patel
  • 1,758
  • 2
  • 21
  • 38

3 Answers3

1

The PdfRenderer class simply converts a PDF page to image. If you want to display some page thumbnails it is just fine, but if need a PDF viewer with support for document navigation and zooming then implementing it on top of the PdfRenderer becomes a very complex task.

iPDFdev
  • 5,229
  • 2
  • 17
  • 18
0

PdfRenderer was added in API Level 21 - so if you want to support earlier models of the Android OS, you have to use something else. That's the only reason I can think of. I guess it depends on how complicated your needs are.

DKIT
  • 3,471
  • 2
  • 20
  • 24
-1

Just pass URI of your pdf file this will help you to display a pdf in a OS Supported Pdf viewer

Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(Url));
startActivity(browserIntent);
Milap Pancholi
  • 134
  • 1
  • 12
  • That requires that the user has installed a PDF viewer on the device. – DKIT May 11 '17 at 07:51
  • The OP did not ask how to display a pdf, but why top results of displaying pdf's are suggesting to use third party libraries instead of the built-in way. This answer does not help the OP. – Denny May 11 '17 at 07:53
  • No that not require to installed pdf viewer on device it will give a list of categories of application supported to view pdf file so you don't worry about that – Milap Pancholi May 11 '17 at 07:55