Skip to content

Commit

Permalink
fix:add metadata to pdf regardless of build settings
Browse files Browse the repository at this point in the history
set metadata when the provider is created
  • Loading branch information
Fernando-hub527 committed Oct 15, 2024
1 parent a325355 commit cde7411
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions maroto.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,6 @@ func (m *Maroto) RegisterFooter(rows ...core.Row) error {
// Generate is responsible to compute the component tree created by
// the usage of all other Maroto methods, and generate the PDF document.
func (m *Maroto) Generate() (core.Document, error) {
m.provider.SetProtection(m.config.Protection)
m.provider.SetCompression(m.config.Compression)
m.provider.SetMetadata(m.config.Metadata)

m.fillPageToAddNew()
m.setConfig()

Expand Down Expand Up @@ -392,5 +388,9 @@ func getConfig(configs ...*entity.Config) *entity.Config {

func getProvider(cache cache.Cache, cfg *entity.Config) core.Provider {
deps := gofpdf.NewBuilder().Build(cfg, cache)
return gofpdf.New(deps)
provider := gofpdf.New(deps)
provider.SetMetadata(cfg.Metadata)
provider.SetCompression(cfg.Compression)
provider.SetProtection(cfg.Protection)
return provider
}

0 comments on commit cde7411

Please sign in to comment.