pdf-front-validator
v1.0.1
Published
This library was created to validate real type of a document PDF on front-end.
Downloads
7
Maintainers
Readme
Overview
The PDF Front Validator library is a tool that simplifies the process of validating PDF files when developing front-end interfaces.
Use the main function to validate whether a file is in fact a PDF or whether it has been renamed with the pdf extension.
Technology
- ⚛️ React 18
- ⛑ TypeScript
- ⛑ Vite
- 📏 ESLint
- 💖 Prettier
Install
NPM:
npm i pdf-front-validator
Yarn
yarn add pdf-front-validator
Usage
React example
import { validateFilePDF } from 'pdf-front-validator'
function App() {
const selectedFile = e.target.files[0]
validateFilePDF(selectedFile)
.then((result) => {
if (result !== undefined) {
// It's a PDF file
} else {
// It's not a PDF file
}
})
.catch((error) => {
console.error("Error to validate PDF File. ln: 58 Error => ", error);
return;
});
}
Made with 💗 by Patrick Gratão