1

Is there any pdf viewer component for to see pdf in my angular app. I am tried angular-pdfjs-viewer but it does not work well. I have only a link to pdf file in server.

Thanks in advance

byteC0de
  • 5,153
  • 5
  • 33
  • 66

1 Answers1

2

You can display the pdf using an iframe inside your application, have the url in a $scope variable as below

$scope.yourURL = "pdfUrl";

Then

<iframe src="{{yourURL | trustAsResourceUrl}}"></iframe>

Also you need to use the above filter.

.filter('trustAsResourceUrl', ['$sce', function($sce) {
    return function(val) {
        return $sce.trustAsResourceUrl(val);
    };
}])
Sajeetharan
  • 216,225
  • 63
  • 350
  • 396