1

How do I get the total page count with pdf.js?

<script type="text/javascript">
$( document ).ready(function() {
  var pdf = pdfjs.getDocument('test.pdf');
  alert(pdf.numPages);
});
</script>
Alon Eitan
  • 11,997
  • 8
  • 49
  • 58
Leo
  • 11
  • 1
  • 3

1 Answers1

1

I don't know much about pdfjs but you can try this:

<script type="text/javascript">
$( document ).ready(function() {
    pdfjs.getDocument('test.pdf').then(function(pdf){
        alert(pdf.numPages);
    });
});
</script>
Hello World
  • 2,673
  • 7
  • 28
  • 60