3.4.1 • Published 12 months ago

react-pdf-ner-annotator v3.4.1

Weekly downloads
9
License
MIT
Repository
github
Last release
12 months ago

react-pdf-ner-annotator

A React component to annotate named entities directly onto a PDF.

Live demo

Features

  • NER annotation
  • Area annotation
  • OCR on scanned PDFs

Installation

The package can be installed through NPM.

npm install react-pdf-ner-annotator

Usage

For simple example usage you can refer to example/src/App.tsx.

import Annotator from 'react-pdf-ner-annotator';
// import the css
import 'react-pdf-ner-annotator/lib/css/style.css';
// OR import the sass
import 'react-pdf-ner-annotator/lib/scss/style.scss';
<Annotator url={'http://example.pdf'} />

Properties

NameTypeRequiredDefault valueDescription
urlstringEither url or data is requiredundefinedThe URL of the PDF.
dataUint8ArrayBufferSourcestringEither data or url is requiredundefinedThe PDF as binary or base64 encoded string.
httpHeaders{ [key: string]: string }noundefinedExtra fields for in the HTTP header when for example authentication is needed.
initialScalenumberno1.5The initial scale to display the PDF as. Must be between 1 and 2.
tokenizerRegExpnoA Regular expression for the tokenization of the paragraphs.
disableOCRbooleannofalseYou can set this value to true if your PDF doesn't have a text layer and you don't want the frontend to run OCR.
entityEntitynoundefinedThe active Entity to annotate on the PDF.
initialTextmapArray<TextLayer>noundefinedA array of TextLayer if you want to provide your own TextLayer for the PDF instead of letting the frontend generate one.
defaultAnnotationsArray<Annotation>no[]An array of Annotation to show on the PDF.
refrefnoundefinedA ref to pass to the Annotator, this ref can be used to call removeAnnotation.

Callback methods

NameParametersReturn typeRequiredDescription
getAnnotationsannotations: ArrayvoidyesProvide a method that takes an array of Annotation as input. This method can be the set of a useState hook for example. This is to subscribe to changes of the annotations made on the PDF.
getTextMapsmaps: ArrayvoidnoSame as the annotations but for the text layers. This will only return text layers of pages with annotations on them.

Local development

Contributors

3.4.1

12 months ago

3.4.0

1 year ago

3.3.2

2 years ago

3.2.0

2 years ago

3.3.1

2 years ago

3.3.0

2 years ago

2.3.0-rc.2

2 years ago

2.3.0-rc.1

2 years ago

2.3.0-rc.4

2 years ago

2.3.0-rc.3

2 years ago

2.3.0-rc.6

2 years ago

2.3.0-rc.5

2 years ago

2.3.0-rc.8

2 years ago

2.3.0-rc.7

2 years ago

2.3.0-rc.9

2 years ago

3.0.0

2 years ago

3.1.3

2 years ago

3.1.2

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

3.1.6

2 years ago

3.1.5

2 years ago

3.1.4

2 years ago

2.2.9

2 years ago

2.2.8

2 years ago

2.2.1

2 years ago

2.2.0

2 years ago

2.2.3

2 years ago

2.2.2

2 years ago

2.2.5

2 years ago

2.2.4

2 years ago

2.2.7

2 years ago

2.2.6

2 years ago

2.1.1

2 years ago

2.1.0

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.2

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

1.0.0-alpha.8

3 years ago

1.0.0-alpha.7

4 years ago

1.0.0-alpha.6

4 years ago

1.0.0-alpha.5

4 years ago

1.0.0-alpha.4

4 years ago

1.0.0-alpha.3

4 years ago

1.0.0-alpha.2

4 years ago

1.0.0-alpha.1

4 years ago