gocr

package module
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2021 License: MIT Imports: 12 Imported by: 0

README

PDF OCR

Convert PDFs to Mathpix Markdown, Microsoft Word or LaTeX:

Install

If you have Go installed simply run:

go get github.com/montanaflynn/gocr/cmd/gocr

Otherwise download the latest binary release for your platform at:

https://github.com/montanaflynn/gocr/releases

Usage

Sign up for an OCR API key at https://accounts.mathpix.com then run gocr:

Interactive
gocr
? What is your mathpix api key? ********************
? Which file should be used as an input? example.pdf
? Where would you like to save it? example.mmd
? Do you agree to the cost of $1.20 for 12 pages? Yes
✓ Saved example.mmd
Non-interactive
export MATHPIX_OCR_API_KEY=...
gocr --agree example.pdf example.docx
✓ Saved example.docx
CLI configuration, arguments and flags:
  • You can set input and output paths as arguments gocr input.pdf output.docx
  • You can set the API key with an environment variable MATHPIX_OCR_API_KEY
  • You can set the API key with the flag gocr --api-key ...
  • You can skip the cost agreement with the flag gocr --agree
  • You can view all flags and arguments with gocr --help

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BaseURL = "https://api.mathpix.com/v3"

BaseURL is the OCR API to use

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is used to call the Mathpix OCR API

func NewClient

func NewClient(appKey string) *Client

NewClient creates a ocr client instance

func (*Client) Convert

func (c *Client) Convert(source, destination string) error

Convert PDF to MMD

func (*Client) SetSpinner

func (c *Client) SetSpinner(spinner *yacspin.Spinner)

SetSpinner sets an optional spinner to show progress

Directories

Path Synopsis
cmd
gocr command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL