From c288bf7dfcb7bcc75b738e3d816849a5f266a584 Mon Sep 17 00:00:00 2001 From: apardods Date: Fri, 20 Dec 2024 11:12:10 +0000 Subject: [PATCH] Add Zugferd Opt --- goblhtml.go | 7 +++++++ internal/options.go | 2 ++ 2 files changed, 9 insertions(+) diff --git a/goblhtml.go b/goblhtml.go index 9f5f03b..5acfdda 100644 --- a/goblhtml.go +++ b/goblhtml.go @@ -92,6 +92,13 @@ func WithEmbeddedStylesheets() Option { } } +// WithZugferd adds the Zugferd XMP metadata to the HTML document. +func WithZugferd() Option { + return func(o *internal.Opts) { + o.Zugferd = true + } +} + // Render takes the GOBL envelope and attempts to render an HTML document // from it. func Render(ctx context.Context, env *gobl.Envelope, opts ...Option) ([]byte, error) { diff --git a/internal/options.go b/internal/options.go index 9ff6844..b7437c4 100644 --- a/internal/options.go +++ b/internal/options.go @@ -36,6 +36,8 @@ type Opts struct { // are contained inside the HTML output. This is useful for PDF // output or to avoid additional requests. EmbedStylesheets bool + // Zugferd when true, adds the Zugferd XMP metadata to the PDF. + Zugferd bool } // WithOptions prepares the context with the options to use.