document

package
v0.0.0-...-57218f6 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SupportedFormats = map[string][]string{
	"pdf":  {"doc", "docx", "txt", "odt", "rtf"},
	"doc":  {"pdf", "docx", "txt", "odt", "rtf"},
	"docx": {"pdf", "doc", "txt", "odt", "rtf"},
	"odt":  {"pdf", "doc", "docx", "txt", "rtf"},
	"rtf":  {"pdf", "doc", "docx", "txt", "odt"},
	"txt":  {"pdf", "doc", "docx", "odt", "rtf"},
}

SupportedFormats defines the supported input and output formats

Functions

func ConvertDocument

func ConvertDocument(input io.Reader, inputFormat, outputFormat string) ([]byte, error)

ConvertDocument converts a document from one format to another using LibreOffice

func IsFormatSupported

func IsFormatSupported(inputFormat, outputFormat string) bool

func MergeToPDF

func MergeToPDF(images []image.Image, opts PDFOptions) (io.Reader, error)

Types

type ConversionOptions

type ConversionOptions struct {
	InputFormat  string
	OutputFormat string
	Quality      int
}

ConversionOptions contains options for document conversion

type PDFOptions

type PDFOptions struct {
	PageSize      string // "A4", "letter", "legal"
	Orientation   string // "portrait", "landscape", "auto"
	ImagesPerPage int    // 1, 2, or 4
	Quality       int    // JPEG quality for images in PDF
}

Jump to

Keyboard shortcuts

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