Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-pdftotext
Advanced tools
A simple light weight react package to extract plain text from a pdf file.
Light-weight memory-safe client library for extracting plain text from pdf files.
Using npm:
npm install react-pdftotext
Local File Input
Now add a input tag with type="file" to take file input.
<input type="file" accept="application/pdf" onChange={extractText} />
Import the pdf2text function from package
import pdfToText from "react-pdftotext";
function extractText(event) {
const file = event.target.files[0];
pdfToText(file)
.then((text) => console.log(text))
.catch((error) => console.error("Failed to extract text from pdf"));
}
Remote PDF File Input
For Pdf files stored at remote locations
import pdfToText from 'react-pdftotext'
const pdf_url = "REMOTE_PDF_URL"
function extractText() {
const file = await fetch(pdf_url)
.then(res => res.blob())
.catch(error => console.error(error))
pdfToText(file)
.then(text => console.log(text))
.catch(error => console.error("Failed to extract text from pdf"))
}
This project welcomes contributions and suggestions.
FAQs
A simple light weight react package to extract plain text from a pdf file.
The npm package react-pdftotext receives a total of 4,478 weekly downloads. As such, react-pdftotext popularity was classified as popular.
We found that react-pdftotext demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.