byteC0de
byteC0de

Reputation: 5273

Pdf viewer for my angular app

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

Upvotes: 1

Views: 609

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222582

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);
    };
}])

Upvotes: 2

Related Questions