Documentation ¶
Overview ¶
Package image implements creation of images from file and bytes.
Package image implements creation of images from file and bytes.
Index ¶
- func NewAutoFromBytesRow(bytes []byte, extension extension.Type, ps ...props.Rect) core.Row
- func NewAutoFromFileRow(path string, ps ...props.Rect) core.Row
- func NewFromBytes(bytes []byte, extension extension.Type, ps ...props.Rect) core.Component
- func NewFromBytesCol(size int, bytes []byte, extension extension.Type, ps ...props.Rect) core.Col
- func NewFromBytesRow(height float64, bytes []byte, extension extension.Type, ps ...props.Rect) core.Row
- func NewFromFile(path string, ps ...props.Rect) core.Component
- func NewFromFileCol(size int, path string, ps ...props.Rect) core.Col
- func NewFromFileRow(height float64, path string, ps ...props.Rect) core.Row
- type BytesImage
- type FileImage
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAutoFromBytesRow ¶ added in v2.1.0
NewAutoFromBytesRow is responsible to create an instance of an Image wrapped in a automatic row.
func NewAutoFromFileRow ¶ added in v2.1.0
NewFromFileRow is responsible to create an instance of an Image wrapped in a automatic Row.
func NewFromBytes ¶
NewFromBytes is responsible to create an instance of an Image.
Example ¶
ExampleNewFromBytes demonstrates how to create an image component reading bytes.
m := maroto.New() bytes, _ := os.ReadFile("image.png") image := image.NewFromBytes(bytes, extension.Png) col := col.New(12).Add(image) m.AddRow(10, col) // generate document
Output:
func NewFromBytesCol ¶
NewFromBytesCol is responsible to create an instance of an Image wrapped in a Col.
Example ¶
ExampleNewFromBytesCol demonstrates how to create an image component wrapped into a column reading bytes.
m := maroto.New() bytes, _ := os.ReadFile("image.png") imageCol := image.NewFromBytesCol(12, bytes, extension.Png) m.AddRow(10, imageCol) // generate document
Output:
func NewFromBytesRow ¶
func NewFromBytesRow(height float64, bytes []byte, extension extension.Type, ps ...props.Rect) core.Row
NewFromBytesRow is responsible to create an instance of an Image wrapped in a Row.
Example ¶
ExampleNewFromBytesRow demonstrates how to create an image component wrapped into a row reading bytes.
m := maroto.New() bytes, _ := os.ReadFile("image.png") imageRow := image.NewFromBytesRow(10, bytes, extension.Png) m.AddRows(imageRow) // generate document
Output:
func NewFromFile ¶
NewFromFile is responsible to create an instance of an Image.
Example ¶
ExampleNewFromFile demonstrates how to create an image component reading file.
m := maroto.New() image := image.NewFromFile("image.png") col := col.New(12).Add(image) m.AddRow(10, col) // generate document
Output:
func NewFromFileCol ¶
NewFromFileCol is responsible to create an instance of an Image wrapped in a Col.
Example ¶
ExampleNewFromFileCol demonstrates how to create an image component wrapped into a column reading file.
m := maroto.New() imageCol := image.NewFromFileCol(12, "image.png") m.AddRow(10, imageCol) // generate document
Output:
func NewFromFileRow ¶
NewFromFileRow is responsible to create an instance of an Image wrapped in a Row.
Example ¶
ExampleNewFromFileRow demonstrates how to create an image component wrapped into a row reading file.
m := maroto.New() imageRow := image.NewFromFileRow(10, "image.png") m.AddRows(imageRow) // generate document
Output:
Types ¶
type BytesImage ¶
type BytesImage struct {
// contains filtered or unexported fields
}
func (*BytesImage) GetHeight ¶ added in v2.1.0
GetHeight returns the height that the image will have in the PDF
func (*BytesImage) GetStructure ¶
func (b *BytesImage) GetStructure() *node.Node[core.Structure]
GetStructure returns the Structure of an Image.
func (*BytesImage) Render ¶
func (b *BytesImage) Render(provider core.Provider, cell *entity.Cell)
Render renders an Image into a PDF context.
func (*BytesImage) SetConfig ¶
func (b *BytesImage) SetConfig(config *entity.Config)
SetConfig sets the pdf config.
type FileImage ¶
type FileImage struct {
// contains filtered or unexported fields
}
func (*FileImage) GetHeight ¶ added in v2.1.0
GetHeight returns the height that the image will have in the PDF
func (*FileImage) GetStructure ¶
GetStructure returns the Structure of an Image.