Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoCompiler = errors.New("document service has no compiler")
ErrNoCompiler is returned when a DocumentService has neither Compilers nor Compiler.
Functions ¶
This section is empty.
Types ¶
type BuildRequest ¶
type BuildRequest struct {
TemplatePath string
ConfigPath string
Variables *config.Variables // Use complex variables from pkg/
Engine string
OutputPath string
WorkingDir string // Working directory for LaTeX compilation (where assets are symlinked)
DoClean bool
DebugEnabled bool // Enable debug mode for persistent concrete files
Backend ports.BackendOptions // Backend-specific options (e.g. ports.LaTeXOptions); nil = backend defaults
Conversion ConversionSettings
}
BuildRequest encapsulates all parameters for building a document
type BuildResult ¶
BuildResult encapsulates the results of building a document
type CompilerResolver ¶ added in v2.4.0
type CompilerResolver interface {
CompilerFor(engine, templatePath string, opts ports.BackendOptions) (ports.DocumentCompiler, error)
}
CompilerResolver chooses the DocumentCompiler for a request's engine and template, built for the request's backend options.
type CompilerResolverFunc ¶ added in v2.4.0
type CompilerResolverFunc func(engine, templatePath string, opts ports.BackendOptions) (ports.DocumentCompiler, error)
CompilerResolverFunc adapts a function to CompilerResolver.
func (CompilerResolverFunc) CompilerFor ¶ added in v2.4.0
func (f CompilerResolverFunc) CompilerFor(engine, templatePath string, opts ports.BackendOptions) (ports.DocumentCompiler, error)
CompilerFor implements CompilerResolver.
type ConversionSettings ¶
ConversionSettings holds conversion options
type DocumentService ¶
type DocumentService struct {
TemplateProcessor ports.TemplateProcessor
Compiler ports.DocumentCompiler // used when Compilers is nil
Compilers CompilerResolver // picks the compiler per request (engine, template); wins over Compiler
Converter ports.Converter
Cleaner ports.Cleaner
PathOps ports.PathOperations
FileSystem ports.FileSystem
ErrorFactory *apperrors.DomainErrorFactory
}
DocumentService orchestrates the document generation workflow It depends on ports (interfaces) for flexibility and testability
func (*DocumentService) Build ¶
func (s *DocumentService) Build(ctx context.Context, req BuildRequest) (BuildResult, error)
Build orchestrates the entire document generation workflow: 1. Process template with variables 2. Compile LaTeX to PDF 3. Optionally convert PDF to images 4. Optionally clean auxiliary files
func (*DocumentService) CleanDocument ¶
func (s *DocumentService) CleanDocument(ctx context.Context, pdfPath string) error
CleanDocument removes auxiliary files for a given PDF
func (*DocumentService) ConvertDocument ¶
func (s *DocumentService) ConvertDocument(ctx context.Context, pdfPath string, formats []string) ([]string, error)
ConvertDocument converts an existing PDF to images