anydoc

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package anydoc converts documents to Markdown through the embedded anydoc 0.2.4 WebAssembly build

Index

Constants

This section is empty.

Variables

View Source
var ErrNotDocument = errors.New("not a document anydoc reads")

Bytes that neither their content nor the given name mark as a document anydoc reads

View Source
var Extensions = []string{"doc", "docx", "docm", "odt", "pdf", "ppt", "pps", "pot", "pptx", "pptm", "ppsx", "ppsm", "rtf", "epub", "xlsx", "xlsm", "xlsb", "xls", "ods", "odp", "csv"}

Extensions lists the formats the converter accepts, without dots

Functions

func ToMarkdown

func ToMarkdown(ctx context.Context, data []byte, path string) (string, error)

ToMarkdown converts a file's bytes, detecting the format from content with the path extension as fallback

Types

type ConvertError

type ConvertError struct {
	Kind    string
	Message string
	// Pages lists the 1-indexed scanned pages when Kind is NeedsOcrError
	Pages []int
	// PageCount is the page total when Kind is NeedsOcrError
	PageCount int
}

ConvertError is a failure anydoc reported, Kind being the Rust variant name suffixed with Error

func (*ConvertError) Encrypted

func (e *ConvertError) Encrypted() bool

Document locked by a password the conversion was not given

func (*ConvertError) Error

func (e *ConvertError) Error() string

func (*ConvertError) NeedsOCR

func (e *ConvertError) NeedsOCR() bool

NeedsOCR reports whether the conversion failed because the document has no text layer

func (*ConvertError) NoTextLayer

func (e *ConvertError) NoTextLayer() bool

PDF that yielded no text on any page, the one failure the crate reports under that variant once a format is known

Jump to

Keyboard shortcuts

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