Documentation ¶
Index ¶
- type Generator
- func (g *Generator[T]) CapturePDF(browser *rod.Browser, htmlUrl, outputPath string) error
- func (g *Generator[T]) CreateHtmlFile(id int) (*os.File, error)
- func (g *Generator[T]) CreatePdf() error
- func (g *Generator[T]) DeleteFiles() error
- func (g *Generator[T]) GenerateTemplates() error
- func (g *Generator[T]) MergePDFs(inputFiles []string, outputFile string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Generator ¶
type Generator[T any] struct { OutputPath string // directory path for generated data FinalPdf string // the merged pdf name (make sure to include .pdf in the name) Template *template.Template // html template Data []T // valid data for feeding the template HtmlFiles []*os.File // list of generated html files PdfFiles []string // list of generated pdf files SingleHtmlFile bool // If you want the template to be single file only // contains filtered or unexported fields }
func (*Generator[T]) CapturePDF ¶
Automate opening a prowser then capture the html page as single pdf file
func (*Generator[T]) CreateHtmlFile ¶
func (*Generator[T]) DeleteFiles ¶
Delete html and pdf files except the merged pdf
func (*Generator[T]) GenerateTemplates ¶
Generate html templates from the given data and save them into .g.OutputPath
Click to show internal directories.
Click to hide internal directories.