Documentation ¶
Overview ¶
Package config implements custom configuration builder.
Index ¶
- type Builder
- type CfgBuilder
- func (b *CfgBuilder) Build() *entity.Config
- func (b *CfgBuilder) WithAuthor(author string, isUTF8 bool) Builder
- func (b *CfgBuilder) WithBackgroundImage(bytes []byte, ext extension.Type) Builder
- func (b *CfgBuilder) WithCompression(compression bool) Builder
- func (b *CfgBuilder) WithConcurrentMode(chunkWorkers int) Builder
- func (b *CfgBuilder) WithCreationDate(time time.Time) Builder
- func (b *CfgBuilder) WithCreator(creator string, isUTF8 bool) Builder
- func (b *CfgBuilder) WithCustomFonts(customFonts []*entity.CustomFont) Builder
- func (b *CfgBuilder) WithDebug(on bool) Builder
- func (b *CfgBuilder) WithDefaultFont(font *props.Font) Builder
- func (b *CfgBuilder) WithDimensions(width float64, height float64) Builder
- func (b *CfgBuilder) WithDisableAutoPageBreak(disabled bool) Builder
- func (b *CfgBuilder) WithKeywords(keywordsStr string, isUTF8 bool) Builder
- func (b *CfgBuilder) WithMargins(left float64, top float64, right float64) Builder
- func (b *CfgBuilder) WithMaxGridSize(maxGridSize int) Builder
- func (b *CfgBuilder) WithOrientation(orientation orientation.Type) Builder
- func (b *CfgBuilder) WithPageNumber(pattern string, place props.Place) Builder
- func (b *CfgBuilder) WithPageSize(size pagesize.Type) Builder
- func (b *CfgBuilder) WithProtection(protectionType protection.Type, userPassword, ownerPassword string) Builder
- func (b *CfgBuilder) WithSequentialLowMemoryMode(chunkWorkers int) Builder
- func (b *CfgBuilder) WithSequentialMode() Builder
- func (b *CfgBuilder) WithSubject(subject string, isUTF8 bool) Builder
- func (b *CfgBuilder) WithTitle(title string, isUTF8 bool) Builder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder interface { WithPageSize(size pagesize.Type) Builder WithDimensions(width float64, height float64) Builder WithMargins(left float64, top float64, right float64) Builder WithConcurrentMode(chunkWorkers int) Builder WithSequentialMode() Builder WithSequentialLowMemoryMode(chunkWorkers int) Builder WithDebug(on bool) Builder WithMaxGridSize(maxGridSize int) Builder WithDefaultFont(font *props.Font) Builder WithPageNumber(pattern string, place props.Place) Builder WithProtection(protectionType protection.Type, userPassword, ownerPassword string) Builder WithCompression(compression bool) Builder WithOrientation(orientation orientation.Type) Builder WithAuthor(author string, isUTF8 bool) Builder WithCreator(creator string, isUTF8 bool) Builder WithSubject(subject string, isUTF8 bool) Builder WithTitle(title string, isUTF8 bool) Builder WithCreationDate(time time.Time) Builder WithCustomFonts([]*entity.CustomFont) Builder WithBackgroundImage([]byte, extension.Type) Builder WithDisableAutoPageBreak(disabled bool) Builder WithKeywords(keywordsStr string, isUTF8 bool) Builder Build() *entity.Config }
Builder is the abstraction responsible for global customizations on the document.
func NewBuilder ¶
func NewBuilder() Builder
NewBuilder is responsible to create an instance of Builder.
type CfgBuilder ¶
type CfgBuilder struct {
// contains filtered or unexported fields
}
func (*CfgBuilder) Build ¶
func (b *CfgBuilder) Build() *entity.Config
Build finalizes the customization returning the entity.Config.
func (*CfgBuilder) WithAuthor ¶
func (b *CfgBuilder) WithAuthor(author string, isUTF8 bool) Builder
WithAuthor defines the author name metadata.
func (*CfgBuilder) WithBackgroundImage ¶
func (b *CfgBuilder) WithBackgroundImage(bytes []byte, ext extension.Type) Builder
WithBackgroundImage defines the background image that will be applied in every page.
func (*CfgBuilder) WithCompression ¶
func (b *CfgBuilder) WithCompression(compression bool) Builder
WithCompression defines compression.
func (*CfgBuilder) WithConcurrentMode ¶ added in v2.0.1
func (b *CfgBuilder) WithConcurrentMode(chunkWorkers int) Builder
WithConcurrentMode defines concurrent generation, chunk workers define how mano chuncks will be executed concurrently.
func (*CfgBuilder) WithCreationDate ¶
func (b *CfgBuilder) WithCreationDate(time time.Time) Builder
WithCreationDate defines the creation date metadata.
func (*CfgBuilder) WithCreator ¶
func (b *CfgBuilder) WithCreator(creator string, isUTF8 bool) Builder
WithCreator defines the creator name metadata.
func (*CfgBuilder) WithCustomFonts ¶
func (b *CfgBuilder) WithCustomFonts(customFonts []*entity.CustomFont) Builder
WithCustomFonts add custom fonts.
func (*CfgBuilder) WithDebug ¶
func (b *CfgBuilder) WithDebug(on bool) Builder
WithDebug defines a debug behaviour where maroto will draw borders in everything.
func (*CfgBuilder) WithDefaultFont ¶
func (b *CfgBuilder) WithDefaultFont(font *props.Font) Builder
WithDefaultFont defines a custom font, other than arial. This can be used to define a custom font as default.
func (*CfgBuilder) WithDimensions ¶
func (b *CfgBuilder) WithDimensions(width float64, height float64) Builder
WithDimensions defines custom page dimensions, this overrides page size.
func (*CfgBuilder) WithDisableAutoPageBreak ¶
func (b *CfgBuilder) WithDisableAutoPageBreak(disabled bool) Builder
WithDisableAutoPageBreak defines the option to disable automatic page breaks.
func (*CfgBuilder) WithKeywords ¶ added in v2.0.5
func (b *CfgBuilder) WithKeywords(keywordsStr string, isUTF8 bool) Builder
Withkeywords defines the document's keyword metadata
func (*CfgBuilder) WithMargins ¶
func (b *CfgBuilder) WithMargins(left float64, top float64, right float64) Builder
WithMargins defines custom margins, bottom margin is not customizable due to gofpdf limitations.
func (*CfgBuilder) WithMaxGridSize ¶
func (b *CfgBuilder) WithMaxGridSize(maxGridSize int) Builder
WithMaxGridSize defines a custom max grid sum which it will change the sum of column sizes.
func (*CfgBuilder) WithOrientation ¶
func (b *CfgBuilder) WithOrientation(orientation orientation.Type) Builder
WithOrientation defines the page orientation. The default orientation is vertical, if horizontal is defined width and height will be flipped.
func (*CfgBuilder) WithPageNumber ¶
func (b *CfgBuilder) WithPageNumber(pattern string, place props.Place) Builder
WithPageNumber defines a string pattern to write the current page and total.
func (*CfgBuilder) WithPageSize ¶
func (b *CfgBuilder) WithPageSize(size pagesize.Type) Builder
WithPageSize defines the page size, ex: A4, A4 and etc.
func (*CfgBuilder) WithProtection ¶
func (b *CfgBuilder) WithProtection(protectionType protection.Type, userPassword, ownerPassword string) Builder
WithProtection defines protection types to the PDF document.
func (*CfgBuilder) WithSequentialLowMemoryMode ¶ added in v2.0.1
func (b *CfgBuilder) WithSequentialLowMemoryMode(chunkWorkers int) Builder
WithSequentialLowMemoryMode defines that maroto will run focusing in reduce memory consumption, chunk workers define how many divisions the work will have.
func (*CfgBuilder) WithSequentialMode ¶ added in v2.0.1
func (b *CfgBuilder) WithSequentialMode() Builder
WithSequentialMode defines that maroto will run in default mode.
func (*CfgBuilder) WithSubject ¶
func (b *CfgBuilder) WithSubject(subject string, isUTF8 bool) Builder
WithSubject defines the subject metadata.