Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

How to load a pdf file into a div using jQuery/AngularJs

ex:

 $.get('/helper/test.pdf', function(data){
              $("#div1").html(data); // like to render pdf in this div
           });

or in angularJs

 $http({ method: 'GET', url: '/helper/test.pdf'}).
           success(function (data) {
               $scope.model.pdfData = data;
           }).
           error(function (data) {
               //alert(data);
           });

Please help me to do this

share|improve this question
1  
you can try using pdf.js by Mozilla using their viewer –  Daniel Ruf Feb 22 at 12:41

1 Answer 1

You can embed your PDF in iframe. There are also javascript libraries which adds some improvements.

There is SO topic about this: To open PDF file in iframe

I would consider reasons to do this again. I think it is much better to open a PDF in new window ...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.