Documentation
¶
Overview ¶
Package pdfengines provides a client for the Gotenberg PDF Engines service. It offers a convenient API for converting PDFs to PDF/A & PDF/UA, reading/writing metadata, merging, splitting, and flattening PDFs.
Index ¶
- Constants
- type PDFEngines
- func (r *PDFEngines) Bool(fieldName string, value bool) *PDFEngines
- func (r *PDFEngines) Convert(ctx context.Context) *PDFEngines
- func (r *PDFEngines) DownloadFrom(data any) *PDFEngines
- func (r *PDFEngines) File(filename string, content io.Reader) *PDFEngines
- func (r *PDFEngines) Flatten(ctx context.Context) *PDFEngines
- func (r *PDFEngines) FlattenPDF(flatten bool) *PDFEngines
- func (r *PDFEngines) Header(key, value string) *PDFEngines
- func (r *PDFEngines) Merge(ctx context.Context) *PDFEngines
- func (r *PDFEngines) Metadata(metadata map[string]any) *PDFEngines
- func (r *PDFEngines) MetadataRead(ctx context.Context) *PDFEngines
- func (r *PDFEngines) MetadataWrite(ctx context.Context) *PDFEngines
- func (r *PDFEngines) OutputFilename(filename string) *PDFEngines
- func (r *PDFEngines) PDFA(pdfa string) *PDFEngines
- func (r *PDFEngines) PDFUA(pdfua bool) *PDFEngines
- func (r *PDFEngines) Param(key, value string) *PDFEngines
- func (r *PDFEngines) Send() (*Response, error)
- func (r *PDFEngines) Split(ctx context.Context) *PDFEngines
- func (r *PDFEngines) SplitMode(mode string) *PDFEngines
- func (r *PDFEngines) SplitSpan(span string) *PDFEngines
- func (r *PDFEngines) SplitUnify(unify bool) *PDFEngines
- func (r *PDFEngines) Trace(trace string) *PDFEngines
- func (r *PDFEngines) WebhookErrorURL(url, method string) *PDFEngines
- func (r *PDFEngines) WebhookHeader(key, value string) *PDFEngines
- func (r *PDFEngines) WebhookURL(url, method string) *PDFEngines
- type Response
Constants ¶
const ( HeaderWebhookURL = "Gotenberg-Webhook-Url" HeaderWebhookErrorURL = "Gotenberg-Webhook-Error-Url" HeaderWebhookMethod = "Gotenberg-Webhook-Method" HeaderWebhookErrorMethod = "Gotenberg-Webhook-Error-Method" HeaderWebhookExtraHTTPHeaders = "Gotenberg-Webhook-Extra-Http-Headers" HeaderOutputFilename = "Gotenberg-Output-Filename" HeaderGotenbergTrace = "Gotenberg-Trace" )
const ( FieldPdfa = "pdfa" FieldPdfua = "pdfua" FieldMetadata = "metadata" FieldSplitMode = "splitMode" FieldSplitSpan = "splitSpan" FieldSplitUnify = "splitUnify" FieldFlatten = "flatten" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PDFEngines ¶
type PDFEngines struct {
// contains filtered or unexported fields
}
PDFEngines represents a Gotenberg conversion request builder. It wraps the underlying multipart request and provides PDF Engines-specific methods.
func NewPDFEngines ¶
func NewPDFEngines(client *httpclient.Client) *PDFEngines
func (*PDFEngines) Bool ¶
func (r *PDFEngines) Bool(fieldName string, value bool) *PDFEngines
Bool adds a boolean form parameter to the request.
func (*PDFEngines) Convert ¶
func (r *PDFEngines) Convert(ctx context.Context) *PDFEngines
Convert creates a request to convert PDFs to PDF/A & PDF/UA.
func (*PDFEngines) DownloadFrom ¶
func (r *PDFEngines) DownloadFrom(data any) *PDFEngines
DownloadFrom sets the download from configuration.
func (*PDFEngines) File ¶
func (r *PDFEngines) File(filename string, content io.Reader) *PDFEngines
File adds a file to the request.
func (*PDFEngines) Flatten ¶
func (r *PDFEngines) Flatten(ctx context.Context) *PDFEngines
Flatten creates a request to flatten PDFs.
func (*PDFEngines) FlattenPDF ¶
func (r *PDFEngines) FlattenPDF(flatten bool) *PDFEngines
Flatten sets the flatten flag.
func (*PDFEngines) Header ¶
func (r *PDFEngines) Header(key, value string) *PDFEngines
Header adds a header to the request.
func (*PDFEngines) Merge ¶
func (r *PDFEngines) Merge(ctx context.Context) *PDFEngines
Merge creates a request to merge PDFs.
func (*PDFEngines) Metadata ¶
func (r *PDFEngines) Metadata(metadata map[string]any) *PDFEngines
Metadata sets the metadata for the PDF.
func (*PDFEngines) MetadataRead ¶
func (r *PDFEngines) MetadataRead(ctx context.Context) *PDFEngines
MetadataRead creates a request to read metadata from PDFs.
func (*PDFEngines) MetadataWrite ¶
func (r *PDFEngines) MetadataWrite(ctx context.Context) *PDFEngines
MetadataWrite creates a request to write metadata to PDFs.
func (*PDFEngines) OutputFilename ¶
func (r *PDFEngines) OutputFilename(filename string) *PDFEngines
OutputFilename sets the output filename.
func (*PDFEngines) PDFA ¶
func (r *PDFEngines) PDFA(pdfa string) *PDFEngines
PDFA converts to PDF/A format.
func (*PDFEngines) PDFUA ¶
func (r *PDFEngines) PDFUA(pdfua bool) *PDFEngines
PDFUA enables PDF for Universal Access.
func (*PDFEngines) Param ¶
func (r *PDFEngines) Param(key, value string) *PDFEngines
Param adds a form parameter to the request.
func (*PDFEngines) Send ¶
func (r *PDFEngines) Send() (*Response, error)
Send executes the request and returns the response. Returns an error if the request fails.
func (*PDFEngines) Split ¶
func (r *PDFEngines) Split(ctx context.Context) *PDFEngines
Split creates a request to split PDFs.
func (*PDFEngines) SplitMode ¶
func (r *PDFEngines) SplitMode(mode string) *PDFEngines
SplitMode sets the split mode.
func (*PDFEngines) SplitSpan ¶
func (r *PDFEngines) SplitSpan(span string) *PDFEngines
SplitSpan sets the split span.
func (*PDFEngines) SplitUnify ¶
func (r *PDFEngines) SplitUnify(unify bool) *PDFEngines
SplitUnify specifies whether to unify split pages.
func (*PDFEngines) Trace ¶
func (r *PDFEngines) Trace(trace string) *PDFEngines
Trace sets the request trace identifier for debugging and monitoring. If not set, Gotenberg will assign a unique UUID trace.
func (*PDFEngines) WebhookErrorURL ¶
func (r *PDFEngines) WebhookErrorURL(url, method string) *PDFEngines
WebhookErrorURL sets the webhook URL and HTTP method for failed operations.
func (*PDFEngines) WebhookHeader ¶
func (r *PDFEngines) WebhookHeader(key, value string) *PDFEngines
WebhookHeader adds a custom header to be sent with webhook requests. Multiple headers can be added by calling this method multiple times.
func (*PDFEngines) WebhookURL ¶
func (r *PDFEngines) WebhookURL(url, method string) *PDFEngines
WebhookURL sets the webhook URL and HTTP method for successful operations.