On-click i need to load a PDF file data on div using ionic 2?

I have created a hybrid mobile app in that i need show a pdf file data on on-click function using angular 2 its possible to implement in ionic2 app any one guide me to implement this feature in my app


Have a look at Open a pdf file in ionic

Just declare the function in the answer as a normal function (without using $scope). This will be undefined during development when the typescript transpiler tries to convert the code to standard JS. To bypass, just do (under the import statements):

declare var windows:any;
declare var cordova:any;

and then in the function before using the window object:


Of course, this will only work once you build for your target platform and deploy.

There’s also Mozilla Foundation’s PDF.JS. Or their npm package. And a very lightweight variant: ViewerJS.

I’m haven’t tried working with PDF.JS or ViewerJS so I don’t know how to use them. Although, this might be a much better way of doing it if you don’t care about using the in-built PDF viewer on the device.