libreoffice

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package libreoffice provides a client for the Gotenberg LibreOffice service. It offers a convenient API for converting Office documents to PDF documents.

Index

Constants

View Source
const (
	HeaderWebhookURL              = gotenberg.HeaderWebhookURL
	HeaderWebhookErrorURL         = gotenberg.HeaderWebhookErrorURL
	HeaderWebhookMethod           = gotenberg.HeaderWebhookMethod
	HeaderWebhookErrorMethod      = gotenberg.HeaderWebhookErrorMethod
	HeaderWebhookExtraHTTPHeaders = gotenberg.HeaderWebhookExtraHTTPHeaders
	HeaderOutputFilename          = gotenberg.HeaderOutputFilename
	HeaderGotenbergTrace          = gotenberg.HeaderGotenbergTrace
)
View Source
const (
	FieldPassword                        = "password"
	FieldLandscape                       = "landscape"
	FieldNativePageRanges                = "nativePageRanges"
	FieldUpdateIndexes                   = "updateIndexes"
	FieldExportFormFields                = "exportFormFields"
	FieldAllowDuplicateFieldNames        = "allowDuplicateFieldNames"
	FieldExportBookmarks                 = "exportBookmarks"
	FieldExportBookmarksToPdfDestination = "exportBookmarksToPdfDestination"
	FieldExportPlaceholders              = "exportPlaceholders"
	FieldExportNotes                     = "exportNotes"
	FieldExportNotesPages                = "exportNotesPages"
	FieldExportOnlyNotesPages            = "exportOnlyNotesPages"
	FieldExportNotesInMargin             = "exportNotesInMargin"
	FieldConvertOooTargetToPdfTarget     = "convertOooTargetToPdfTarget"
	FieldExportLinksRelativeFsys         = "exportLinksRelativeFsys"
	FieldExportHiddenSlides              = "exportHiddenSlides"
	FieldSkipEmptyPages                  = "skipEmptyPages"
	FieldAddOriginalDocumentAsStream     = "addOriginalDocumentAsStream"
	FieldSinglePageSheets                = "singlePageSheets"
	FieldLosslessImageCompression        = "losslessImageCompression"
	FieldQuality                         = "quality"
	FieldReduceImageResolution           = "reduceImageResolution"
	FieldMaxImageResolution              = "maxImageResolution"
	FieldMerge                           = "merge"
	FieldSplitMode                       = "splitMode"
	FieldSplitSpan                       = "splitSpan"
	FieldSplitUnify                      = "splitUnify"
	FieldPdfa                            = "pdfa"
	FieldPdfua                           = "pdfua"
	FieldMetadata                        = "metadata"
	FieldFlatten                         = "flatten"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LibreOffice

type LibreOffice struct {
	*gotenberg.Gotenberg
}

LibreOffice represents a Gotenberg conversion request builder. It wraps the underlying multipart request and provides LibreOffice-specific methods.

func NewLibreOffice

func NewLibreOffice(client *httpclient.Client) *LibreOffice

func (*LibreOffice) AddOriginalDocumentAsStream

func (r *LibreOffice) AddOriginalDocumentAsStream(add bool) *LibreOffice

AddOriginalDocumentAsStream adds original document as stream.

func (*LibreOffice) AllowDuplicateFieldNames

func (r *LibreOffice) AllowDuplicateFieldNames(allow bool) *LibreOffice

AllowDuplicateFieldNames specifies whether multiple form fields can have the same name.

func (*LibreOffice) Bool

func (r *LibreOffice) Bool(fieldName string, value bool) *LibreOffice

Bool adds a boolean form parameter to the conversion request.

func (*LibreOffice) Convert

func (r *LibreOffice) Convert(ctx context.Context) *LibreOffice

Convert creates a request to convert Office documents to PDF. The files parameter should contain the Office documents to be converted.

func (*LibreOffice) ConvertOooTargetToPdfTarget

func (r *LibreOffice) ConvertOooTargetToPdfTarget(convert bool) *LibreOffice

ConvertOooTargetToPdfTarget converts OOo target to PDF target.

func (*LibreOffice) DownloadFrom

func (r *LibreOffice) DownloadFrom(data gotenberg.DownloadFrom) *LibreOffice

DownloadFrom sets the downloadFrom parameter for downloading files from URLs. The data should be a slice of DownloadItem representing the download configuration.

func (*LibreOffice) ExportBookmarks

func (r *LibreOffice) ExportBookmarks(export bool) *LibreOffice

ExportBookmarks specifies if bookmarks are exported to PDF.

func (*LibreOffice) ExportBookmarksToPdfDestination

func (r *LibreOffice) ExportBookmarksToPdfDestination(export bool) *LibreOffice

ExportBookmarksToPdfDestination specifies bookmarks export to PDF destination.

func (*LibreOffice) ExportFormFields

func (r *LibreOffice) ExportFormFields(export bool) *LibreOffice

ExportFormFields specifies whether form fields are exported as widgets.

func (*LibreOffice) ExportHiddenSlides

func (r *LibreOffice) ExportHiddenSlides(export bool) *LibreOffice

ExportHiddenSlides exports hidden slides for Impress.

func (*LibreOffice) ExportLinksRelativeFsys

func (r *LibreOffice) ExportLinksRelativeFsys(export bool) *LibreOffice

ExportLinksRelativeFsys exports relative filesystem links.

func (*LibreOffice) ExportNotes

func (r *LibreOffice) ExportNotes(export bool) *LibreOffice

ExportNotes specifies if notes are exported to PDF.

func (*LibreOffice) ExportNotesInMargin

func (r *LibreOffice) ExportNotesInMargin(export bool) *LibreOffice

ExportNotesInMargin specifies if notes in margin are exported.

func (*LibreOffice) ExportNotesPages

func (r *LibreOffice) ExportNotesPages(export bool) *LibreOffice

ExportNotesPages specifies if notes pages are exported to PDF.

func (*LibreOffice) ExportOnlyNotesPages

func (r *LibreOffice) ExportOnlyNotesPages(export bool) *LibreOffice

ExportOnlyNotesPages specifies if only notes pages are exported.

func (*LibreOffice) ExportPlaceholders

func (r *LibreOffice) ExportPlaceholders(export bool) *LibreOffice

ExportPlaceholders exports placeholders fields visual markings only.

func (*LibreOffice) File

func (r *LibreOffice) File(filename string, content io.Reader) *LibreOffice

File adds a file to the conversion request.

func (*LibreOffice) Flatten

func (r *LibreOffice) Flatten(flatten bool) *LibreOffice

Flatten flattens the resulting PDF.

func (*LibreOffice) Float

func (r *LibreOffice) Float(fieldName string, value float64) *LibreOffice

Float adds a float64 form parameter to the conversion request.

func (*LibreOffice) Header

func (r *LibreOffice) Header(key, value string) *LibreOffice

Header adds a header to the conversion request.

func (*LibreOffice) Landscape

func (r *LibreOffice) Landscape(landscape bool) *LibreOffice

Landscape sets the paper orientation to landscape.

func (*LibreOffice) LosslessImageCompression

func (r *LibreOffice) LosslessImageCompression(lossless bool) *LibreOffice

LosslessImageCompression specifies lossless compression for images.

func (*LibreOffice) MaxImageResolution

func (r *LibreOffice) MaxImageResolution(resolution int) *LibreOffice

MaxImageResolution sets the max image resolution in DPI.

func (*LibreOffice) Merge

func (r *LibreOffice) Merge(merge bool) *LibreOffice

Merge merges the resulting PDFs alphanumerically.

func (*LibreOffice) Metadata

func (r *LibreOffice) Metadata(key, value string) *LibreOffice

Metadata sets the metadata for the PDF.

func (*LibreOffice) NativePageRanges

func (r *LibreOffice) NativePageRanges(ranges string) *LibreOffice

NativePageRanges sets the page ranges to print.

func (*LibreOffice) OutputFilename

func (r *LibreOffice) OutputFilename(filename string) *LibreOffice

OutputFilename sets the output filename for the generated PDF.

func (*LibreOffice) PDFA

func (r *LibreOffice) PDFA(pdfa string) *LibreOffice

PDFA converts to PDF/A format.

func (*LibreOffice) PDFUA

func (r *LibreOffice) PDFUA(pdfua bool) *LibreOffice

PDFUA enables PDF for Universal Access.

func (*LibreOffice) Param

func (r *LibreOffice) Param(key, value string) *LibreOffice

Param adds a form parameter to the conversion request.

func (*LibreOffice) Password

func (r *LibreOffice) Password(password string) *LibreOffice

Password sets the password for opening the source file.

func (*LibreOffice) Quality

func (r *LibreOffice) Quality(quality int) *LibreOffice

Quality sets the JPG export quality.

func (*LibreOffice) ReduceImageResolution

func (r *LibreOffice) ReduceImageResolution(reduce bool) *LibreOffice

ReduceImageResolution reduces image resolution.

func (*LibreOffice) Send

func (r *LibreOffice) Send() (*gotenberg.Response, error)

Send executes the conversion request and returns the response. Returns an error if the request fails or the conversion cannot be completed.

func (*LibreOffice) SinglePageSheets

func (r *LibreOffice) SinglePageSheets(single bool) *LibreOffice

SinglePageSheets puts every sheet on exactly one page.

func (*LibreOffice) SkipEmptyPages

func (r *LibreOffice) SkipEmptyPages(skip bool) *LibreOffice

SkipEmptyPages suppresses automatically inserted empty pages.

func (*LibreOffice) SplitMode

func (r *LibreOffice) SplitMode(mode string) *LibreOffice

SplitMode sets the split mode.

func (*LibreOffice) SplitSpan

func (r *LibreOffice) SplitSpan(span string) *LibreOffice

SplitSpan sets the split span.

func (*LibreOffice) SplitUnify

func (r *LibreOffice) SplitUnify(unify bool) *LibreOffice

SplitUnify specifies whether to unify split pages.

func (*LibreOffice) Trace

func (r *LibreOffice) Trace(trace string) *LibreOffice

Trace sets the request trace identifier for debugging and monitoring. If not set, Gotenberg will assign a unique UUID trace.

func (*LibreOffice) UpdateIndexes

func (r *LibreOffice) UpdateIndexes(update bool) *LibreOffice

UpdateIndexes specifies whether to update the indexes before conversion.

func (*LibreOffice) WebhookErrorURL

func (r *LibreOffice) WebhookErrorURL(url, method string) *LibreOffice

WebhookErrorURL sets the webhook URL and HTTP method for failed conversions.

func (*LibreOffice) WebhookHeader

func (r *LibreOffice) WebhookHeader(key, value string) *LibreOffice

WebhookHeader adds a custom header to be sent with webhook requests. Multiple headers can be added by calling this method multiple times.

func (*LibreOffice) WebhookURL

func (r *LibreOffice) WebhookURL(url, method string) *LibreOffice

WebhookURL sets the webhook URL and HTTP method for successful conversions.

type Response

type Response = gotenberg.Response

Response represents a Gotenberg conversion response. It wraps the HTTP response and provides access to the Gotenberg trace header.

Jump to

Keyboard shortcuts

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