Rendering a local PDF in Ionic


#1

I know this has been asked a number of times, but i’m stuck.

I’ve got

<a class="item" href="#" onclick="window.open('assets/ds.pdf', '_system', 'location=no')">

the pdf is in www/assets/

When I run it in my browser it works, but when i try it on the emulator it doesn’t display.

Any ideas?


#2

Hi,
Android does not support viewing PDFs out of the box in a WebView. On iOS it works ok.

There are options:

  1. Using Google Docs to render the PDF for you:
    http://stackoverflow.com/questions/9434487/open-pdf-in-a-webview
  2. For offline use, you can try with PDF.js:
    https://github.com/mozilla/pdf.js/
    And example:
    http://mozilla.github.io/pdf.js/examples/learning/prevnext.html