Server IP : 162.214.80.37 / Your IP : 216.73.216.68 Web Server : Apache System : Linux sh013.webhostingservices.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 User : imyrqtmy ( 2189) PHP Version : 8.2.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0750) : /home2/imyrqtmy/public_html/eventsbyshubhchintak/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.11.338/pdf.min.js"></script> </head> <body> <div class="container"> <h2>Vertical (basic) form</h2> <form action=""> <div class="form-group"> <label for="email">File</label> <input type="file" class="form-control" id="pdfInput" > </div> <button type="submit" class="btn btn-default">Submit</button> </form> </div> </body> <script> $(document).ready(function() { // Function to calculate the page count of the uploaded PDF function calculatePageCount(pdfData) { return pdfData.numPages; } // Event listener for the input field change $('#pdfInput').on('change', function(event) { var file = event.target.files[0]; if (file) { var fileReader = new FileReader(); fileReader.onload = function() { var arrayBuffer = this.result; // Load the PDF using PDF.js pdfjsLib.getDocument(arrayBuffer).promise.then(function(pdf) { var pageCount = pdf.numPages; alert(pageCount); console.log('Page count:', pageCount); }).catch(function(error) { console.error('Error loading PDF:', error); }); }; fileReader.readAsArrayBuffer(file); } }); }); </script> </html>