Skip to content

patrickgratao/pdf-front-validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PDF Front-end Validator


Overview   |    Install   

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

About

This library validate real type of a document PDF on front-end.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published