Skip to content
kbaPublic

About

Working with hOCR in Javascript

Resources

Stars

135 stars

Watchers

8 watching

Forks

Latest commit

 

History

160 Commits

Folders and files

Repository files navigation

hocrjs

Working with hOCR in Javascript

Showcase

Demo

See this demo document: Demo

Video

video of hocrjs

Screenshots

background image, transparent text

text only, scaled font

Usage

Simple Usage

To add the interface to a plain hOCR file, add this line just before the closing tag:

<script src="https://unpkg.com/hocrjs">script>

In addition, your webserver must set the Content-Type to a value that allows loading scripts, such as text/html. If your hOCR file uses an extension .html or .htm extension, the media type should be set correctly.

For files with a .hocr extension (e.g. generated by tesseract), you will need to add a mapping from extension to media type:

  • Apache: Add the following to you server configuration or .htaccess file:

    AddType text/html hocr
  • nginx: Add to mime.types:

    text/html    hocr;
    

User script

Also bundled is a browser extension that lets you add the hocrjs interface to any hOCR document you browse on the web.

Tampermonkey:

Tampermonkey

Greasemonkey:

Greasemonkey

Command line interface

hocrjs comes with a command line tool hocrjs-inject that inserts the necessary