Working with PDFs or other files can sometimes be a bit tricky, especially when the WKWebView on iOS handles stuff differently or you only get some binary data from an API. There are a many things that can go wrong, but let’s take a look at an easy way to open and display PDFs with Ionic.
In this Quick Win we will handle both cases: Open a PDF that exists in the assets folder of our app and also downloading and displaying data from anywhere on the web as a file to our device.
This is how the final result of our opened PDF will later look like on a device!
The full quick win with snippets is only available to Ionic Academy members.
Join now for
- Unlimited access to all quick wins
- Library of 40+ step-by-step video courses
- Support for Ionic questions via Slack & private community
Current member? LOGIN
Good one
not work with me it’s navigate me to (playstore) to download (cleverdox viewer)
I got this request too. It’s a little strange. I’m pretty sure it downloaded the PDF, but, I noticed it actually does a search for this app specifically, as per the logs.
I/chromium: [INFO:CONSOLE(424)] “App de.sitewaerts.cleverdox.viewer successfully installed”, source: file:///android_asset/www/plugins/cordova-plugin-document-viewer/www/sitewaertsdocumentviewer.js (424)
Further to my last, the plugin is designed to pull that app. It’s listed in the documentation here:
https://github.com/sitewaerts/cordova-plugin-document-viewer
not work with me it’s navigate me to (playstore) to download (cleverdox viewer)
x2
me too, is there any solution for this
i don’t know why Is not working for me
Hi am getting below errors,
ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[HomePage -> DocumentViewer]:
StaticInjectorError(Platform: core)[HomePage -> DocumentViewer]:
NullInjectorError: No provider for DocumentViewer!
Error: StaticInjectorError(AppModule)[HomePage -> DocumentViewer]:
StaticInjectorError(Platform: core)[HomePage -> DocumentViewer]:
NullInjectorError: No provider for DocumentViewer!
at _NullInjector.prototype.get (http://localhost:8100/build/vendor.js:1377:13)
at resolveToken (http://localhost:8100/build/vendor.js:1675:9)
at tryResolveToken (http://localhost:8100/build/vendor.js:1617:9)
at StaticInjector.prototype.get (http://localhost:8100/build/vendor.js:1485:13)
at resolveToken (http://localhost:8100/build/vendor.js:1675:9)
at tryResolveToken (http://localhost:8100/build/vendor.js:1617:9)
at StaticInjector.prototype.get (http://localhost:8100/build/vendor.js:1485:13)
at resolveNgModuleDep (http://localhost:8100/build/vendor.js:11270:5)
at NgModuleR
its working but need cleverdox viewer download from playstore can we open the pdf without cleverbox viewer ?
can i get annotations on the opened PDF?
https://uploads.disquscdn.com/images/ca6f0c588261113cc27010798842585983ee29b743cebbda1cef922416db1025.png
Throwing error i followed exactly as you did.
May i know to resolve this error.
Error: exec proxy not found for :: SitewaertsDocumentViewer :: canViewDocument
sitewaertsdocumentviewer.js:208 Error in SitewaertsDocumentViewer.canViewDocument(): Missing Command Error
sitewaertsdocumentviewer.js:343 Error in SitewaertsDocumentViewer.viewDocument(): Missing Command Error
same here!! did you solved it?
It’s working with me. But i have a question, when my android device doesn’t support open pdf format, plugin will suggest cleverdox Viewer is application, which open pdf file downloaded to local.
Thanks you so much !!
Hello I use ionic 3.20.1. I use the same code but anything on my phone