func (mod PDFEngines) PDFEngine() (gotenberg.PDFEngine, error) {
	engines := make([]gotenberg.PDFEngine, len(mod.engines))
	i := 0
	for _, engine := range mod.engines {
		engines[i] = engine
		i++
	}
	return newMultiPDFEngines(engines...), nil
}
PDFEngine returns a gotenberg.PDFEngine.
package pdfengines
import (
	"errors"
	"fmt"
	"github.com/gotenberg/gotenberg/v7/pkg/gotenberg"
	"github.com/gotenberg/gotenberg/v7/pkg/modules/api"
	flag "github.com/spf13/pflag"
)
func init() {
	gotenberg.MustRegisterModule(PDFEngines{})
}
type PDFEngines struct {
	names         []string
	engines       []gotenberg.PDFEngine
	disableRoutes bool
}
func (PDFEngines) Descriptor() gotenberg.ModuleDescriptor {
	return gotenberg.ModuleDescriptor{
		ID: "pdfengines",
		FlagSet: func() *flag.FlagSet {
			fs := flag.NewFlagSet("pdfengines", flag.ExitOnError)
			fs.StringSlice("pdfengines-engines", make([]string, 0), "Set the PDF engines - all by default")
			fs.Bool("pdfengines-disable-routes", false, "Disable the routes")
			return fs
		}(),
		New: func() gotenberg.Module { return new(PDFEngines) },
	}
}
func (mod *PDFEngines) Provision(ctx *gotenberg.Context) error {
	flags := ctx.ParsedFlags()
	names := flags.MustStringSlice("pdfengines-engines")
	mod.disableRoutes = flags.MustBool("pdfengines-disable-routes")
	engines, err := ctx.Modules(new(gotenberg.PDFEngine))
	if err != nil {
		return fmt.Errorf("get PDF engines: %w", err)
	}
	mod.engines = make([]gotenberg.PDFEngine, len(engines))
	for i, engine := range engines {
		mod.engines[i] = engine.(gotenberg.PDFEngine)
	}
	if len(names) > 0 {
		mod.names = names
		return nil
	}
	mod.names = make([]string, len(mod.engines))
	for i, engine := range mod.engines {
		mod.names[i] = engine.(gotenberg.Module).Descriptor().ID
	}
	return nil
}
func (mod PDFEngines) Validate() error {
	if len(mod.engines) == 0 {
		return errors.New("no PDF engine")
	}
	availableEngines := make([]string, len(mod.engines))
	for i, engine := range mod.engines {
		availableEngines[i] = engine.(gotenberg.Module).Descriptor().ID
	}
	nonExistingEngines := make([]string, 0)
	for _, name := range mod.names {
		engineExists := false
		for _, engine := range mod.engines {
			if name == engine.(gotenberg.Module).Descriptor().ID {
				engineExists = true
				break
			}
		}
		if !engineExists {
			nonExistingEngines = append(nonExistingEngines, name)
		}
	}
	if len(nonExistingEngines) == 0 {
		return nil
	}
	return fmt.Errorf("non-existing PDF engine(s): %s - available PDF engine(s): %s", nonExistingEngines, availableEngines)
}