How to upload a PDF file to a web page, get the PDF fields values and render them into the same web page fields using JavaScript

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


    <script src=""></script>



    <input type="file" id="file-id" name="file_name" onchange="ExtractText();">

    <!-- a container for the output -->

    <div id="output"></div>


        function ExtractText() {

            var input = document.getElementById("file-id");    



                console.log("This PDF has "+doc._pdfInfo.numPages+" pages");





Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:


Hi There,

I see that you’re using the PDF.js library.
This forum is specifically for support of our product PDF.js Express, so, unfortunately, we cannot help you with this.



Hi, I do not mind using any other SW to get the function delivered. Are the above requirements can be done with PDF.js Express