I'd like to display a PDF on my smartphone application.

Asked 1 years ago, Updated 1 years ago, 59 views

I'm making a smartphone app with Monaca.

I'd like to display a certain venue map in PDF format, but what should I do?

When I tried the following, I saw Couldn't load plug-in.

<ons-page>
    <object data="img/map.pdf" id="info_map" type="application/pdf">/object>
</ons-page>

monaca onsen-ui

2022-09-30 14:57

3 Answers

If iOS is the only target, I think it can be opened using the Inappbrowser plug-in.
If Android is also supported, it will be a little more difficult.

----- As I am not an Android user, all of the following have not been verified to work -----

There seems to be a way to open it in GoogleDocs like this (see the link below for more information).

window.open(encodeURI('https://docs.google.com/gview?embedded=true&url=<pdfuri>'),'_blank','location=yes, EnableViewPortScale=yes')

Also, it seems that the beta version is still available, but cordova-plugin-document-viewer also supports Android.

Note: Notable to launch apdf file in inappbrowser in android

If you want to open a local PDF, you can use FileOpener.


2022-09-30 14:57

Thank you for your reply.

It's done on Android.

However, I would like to open a local PDF, so I would like to try FileOpener, but the threshold seems a little high.

Thank you.


2022-09-30 14:57

If you want to display pdf in Monaca's webview, you may be able to use Mozilla's PDF.js.

However, the webview appears to be limited support.


2022-09-30 14:57

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.