PDFs

Your app will automatically handle PDFs, but they are handled differently depending on the situation. Here's how they work.

Remote files: any remote PDF (hosted on the web) will be viewed in the web browser
Local files: any PDF in the assets folder, or downloaded to your app will use a local PDF viewer outside the app.

PDFs will be available for download outside of your app, it is not possible to restrict PDFs to be viewed only in your app.

Requirements

To view local PDF files on Android, your app users must have a PDF Reader app installed. It can be any app that handles PDFs, for example Acrobat Reader.

iOS handles PDFs natively and does not have any requirements.

Display PDF from URL

If the PDF is on your website, you can just link to it from the app.

Using the button block:

Using a custom HTML page:

<a href="https://mysite.com/path-to-file.pdf" target="_blank">View PDF</a>

Android does not have a PDF viewer, so you may need to include a link for Android like this:

<a href="https://docs.google.com/viewer?url=http://research.google.com/archive/bigtable-osdi06.pdf" target="_blank">Android Only</a>

Display a local PDF

You can include a PDF in your app using offline files. These files cannot be updated remotely, so you should only use this method if you do not need to update the PDF.

Using the button block:

Using a custom HTML page:

// local file (must be included in offline assets folder)
<ion-button (click)="mediaModal('files/path-to-file.pdf')">View PDF</ion-button>

Display Downloaded PDFs

Any PDFs downloaded to the app from WordPress or using the media list with downloads enabled, will automatically open a PDF viewer outside the app. This works while offline.

Custom Links to PDFs in WordPress

If you have a link to a PDF in a WordPress page, it will work fine in iOS.

Android does not have a native PDF viewer, so you may need to change your link to use an online PDF viewer like this:

<a href="https://docs.google.com/viewer?url=http://research.google.com/archive/bigtable-osdi06.pdf" target="_blank">View PDF</a>