Skip to content

Instantly share code, notes, and snippets.

@FabianoCampos
Created November 28, 2019 16:47
Show Gist options
  • Save FabianoCampos/f9e28c42662f60a8bfe1b892c214438d to your computer and use it in GitHub Desktop.
Save FabianoCampos/f9e28c42662f60a8bfe1b892c214438d to your computer and use it in GitHub Desktop.
Pegar a quantidade de páginas do arquivo com JavaScript
var input = document.getElementById("files");
var reader = new FileReader();
reader.readAsBinaryString(input.files[0]);
reader.onloadend = function(){
var count = reader.result.match(/\/Type[\s]*\/Page[^s]/g).length;
console.log('Number of Pages:',count );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment