Documentation ¶
Index ¶
- Variables
- type API
- type Options
- type UnoconvFormat
- func (mod UnoconvFormat) Convert(ctx context.Context, logger *zap.Logger, inputPath, outputPath string, ...) error
- func (UnoconvFormat) Descriptor() gotenberg.ModuleDescriptor
- func (mod UnoconvFormat) Extensions() []string
- func (mod UnoconvFormat) Metrics() ([]gotenberg.Metric, error)
- func (mod *UnoconvFormat) Provision(ctx *gotenberg.Context) error
- func (mod UnoconvFormat) Routes() ([]api.Route, error)
- func (mod UnoconvFormat) UnoconvFormat() (API, error)
- func (mod UnoconvFormat) Validate() error
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidFormat = errors.New("format is invalid")
ErrInvalidFormat happens if the format option is not acceptable by LibreOffice.
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 ¶
func (UnoconvFormat) Descriptor() gotenberg.ModuleDescriptor
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.