unoconvformat

package
v0.0.0-...-92fbaa1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidFormat = errors.New("format is invalid")

ErrInvalidFormat happens if the format option is not acceptable by LibreOffice.

View Source
var ErrMalformedPageRanges = errors.New("page ranges are malformed")

ErrMalformedPageRanges happens if the page ranges option cannot be interpreted by LibreOffice.

Functions

This section is empty.

Types

type API

type API interface {
	Convert(ctx context.Context, logger *zap.Logger, inputPath, outputPath string, options Options) error
	Extensions() []string
}

API is an abstraction on top of unoconv. See https://github.com/unoconv/unoconv.

type Options

type Options struct {
	// PageRanges allows to select the pages to convert (optional)
	PageRanges string

	// Output format, must be one of availableOutputFormats (mandatory)
	Format string
}

Options gathers available options when converting a document

type UnoconvFormat

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

UnoconvFormat is a module which provides an API to interact with unoconv.

func (UnoconvFormat) Convert

func (mod UnoconvFormat) Convert(ctx context.Context, logger *zap.Logger, inputPath, outputPath string, options Options) error

converts a document to giver format. It creates a dedicated LibreOffice instance thanks to a custom user profile directory and a free port. Substantial calls to this method may increase CPU and memory usage drastically. In such a scenario, the given context may also be done before the end of the conversion.

func (UnoconvFormat) Descriptor

Descriptor returns a Unoconv's module descriptor.

func (UnoconvFormat) Extensions

func (mod UnoconvFormat) Extensions() []string

Extensions returns the file extensions available with unoconv.

func (UnoconvFormat) Metrics

func (mod UnoconvFormat) Metrics() ([]gotenberg.Metric, error)

Metrics returns the metrics.

func (*UnoconvFormat) Provision

func (mod *UnoconvFormat) Provision(ctx *gotenberg.Context) error

Provision sets the module properties. It returns an error if the environment variable UNOCONV_BIN_PATH is not set.

func (UnoconvFormat) Routes

func (mod UnoconvFormat) Routes() ([]api.Route, error)

Routes returns the HTTP routes.

func (UnoconvFormat) UnoconvFormat

func (mod UnoconvFormat) UnoconvFormat() (API, error)

Unoconvdoc returns an API for interacting with unoconv.

func (UnoconvFormat) Validate

func (mod UnoconvFormat) Validate() error

Validate validates the module properties.

Jump to

Keyboard shortcuts

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