Which product are you using?
Visual Studio Code
PDF.js Express Version
Detailed description of issue
{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}
Expected behaviour
{Provide a screenshot or description of the expected behaviour}
Does your issue happen with every document, or just one?
{Answer here}
Link to document
{Provide a link to the document in question if possible}
Code snippet
{
<head>
<script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@2.13.216/build/pdf.min.js"></script>
</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('./SamplePDF.pdf').then(doc=>{
console.log("This PDF has "+doc._pdfInfo.numPages+" pages");
});
}
</script>
</body>
}