How to upload a PDF file to a web page, get the PDF fields values and render them into the same web [message #1850856] |
Fri, 18 March 2022 16:10  |
Eclipse User |
|
|
|
{I am trying to develop a web page where I want to upload a PDF file to this web page, get the values of the PDF fields then insert them into the web page fields using JavaScript. May I ask for a sample code on how to do this I tried the following code but did not work
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<input type="file" id="file-id" name="file_name" onchange="ExtractText();">
<!-- a container for the output -->
<div id="output"></div>
<script>
function ExtractText() {
var input = document.getElementById("file-id");
//alert(input.files[0].name);
pdfjsLib.getDocument('./test1.pdf').then(doc=>{
console.log("This PDF has "+doc._pdfInfo.numPages+" pages");
});
}
</script>
</body>
</html>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03384 seconds