简体   繁体   中英

How to extract text from a pdf file in javascript?

So I am wondering if there's a way to extract text from pdf in javascript? I have already surveyed some npm modules like PDF-TO-TEXT but they all take in a file path name as input. I am using the react-drop-to-upload module to allow the user to drop the pdf to a react component. The react component takes in the pdf file and returns a File object rather than a file path. Is there a way to convert PDF stored in an File object to text? Thanks!

PDF.js allows you to load file objects and then parse the document as a text. This example from the official website does exactly that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM