Documentation ¶
Index ¶
- type Maroto
- type PdfMaroto
- func (s *PdfMaroto) AddPage()
- func (s *PdfMaroto) AddUTF8Font(familyStr, styleStr, fileStr string)
- func (s *PdfMaroto) Barcode(code string, prop ...props.Barcode) (err error)
- func (s *PdfMaroto) Base64Image(base64 string, extension consts.Extension, prop ...props.Rect) error
- func (s *PdfMaroto) Col(width uint, closure func())
- func (s *PdfMaroto) ColSpace(gridSize uint)
- func (s *PdfMaroto) FileImage(filePathName string, prop ...props.Rect) error
- func (s *PdfMaroto) GetBorder() bool
- func (s *PdfMaroto) GetCurrentOffset() float64
- func (s *PdfMaroto) GetCurrentPage() int
- func (s *PdfMaroto) GetPageMargins() (left float64, top float64, right float64, bottom float64)
- func (s *PdfMaroto) GetPageSize() (width float64, height float64)
- func (s *PdfMaroto) Line(spaceHeight float64)
- func (s *PdfMaroto) Output() (bytes.Buffer, error)
- func (s *PdfMaroto) OutputFileAndClose(filePathName string) (err error)
- func (s *PdfMaroto) QrCode(code string, prop ...props.Rect)
- func (s *PdfMaroto) RegisterFooter(closure func())
- func (s *PdfMaroto) RegisterHeader(closure func())
- func (s *PdfMaroto) Row(height float64, closure func())
- func (s *PdfMaroto) SetBackgroundColor(color color.Color)
- func (s *PdfMaroto) SetBorder(on bool)
- func (s *PdfMaroto) SetPageMargins(left, top, right float64)
- func (s *PdfMaroto) SetProtection(actionFlag byte, userPassStr, ownerPassStr string)
- func (s *PdfMaroto) Signature(label string, prop ...props.Font)
- func (s *PdfMaroto) TableList(header []string, contents [][]string, prop ...props.TableList)
- func (s *PdfMaroto) Text(text string, prop ...props.Text)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Maroto ¶
type Maroto interface { // Grid System Row(height float64, closure func()) Col(width uint, closure func()) ColSpace(gridSize uint) // Registers RegisterHeader(closure func()) // Outside Col/Row Components TableList(header []string, contents [][]string, prop ...props.TableList) Line(spaceHeight float64) // Inside Col/Row Components Text(text string, prop ...props.Text) FileImage(filePathName string, prop ...props.Rect) (err error) Base64Image(base64 string, extension consts.Extension, prop ...props.Rect) (err error) Barcode(code string, prop ...props.Barcode) error QrCode(code string, prop ...props.Rect) Signature(label string, prop ...props.Font) // File System OutputFileAndClose(filePathName string) error Output() (bytes.Buffer, error) // Helpers AddPage() SetBorder(on bool) SetBackgroundColor(color color.Color) GetBorder() bool GetPageSize() (width float64, height float64) GetCurrentPage() int GetCurrentOffset() float64 SetPageMargins(left, top, right float64) GetPageMargins() (left float64, top float64, right float64, bottom float64) AddUTF8Font(familyStr, styleStr, fileStr string) SetProtection(actionFlag byte, userPassStr, ownerPassStr string) }
Maroto is the principal abstraction to create a PDF document.
func NewMaroto ¶
func NewMaroto(orientation consts.Orientation, pageSize consts.PageSize) Maroto
NewMaroto create a Maroto instance returning a pointer to PdfMaroto Receive an Orientation and a PageSize. Shorthand when using a preset page size from consts.PageSize
func NewMarotoCustomSize ¶ added in v0.27.2
func NewMarotoCustomSize(orientation consts.Orientation, pageSize consts.PageSize, unitStr string, width, height float64) Maroto
NewMarotoCustomSize creates a Maroto instance returning a pointer to PdfMaroto Receive an Orientation and a PageSize. Use if custom page size is needed. Otherwise use NewMaroto() shorthand if using page sizes from consts.Pagesize. If using custom width and height, pageSize is just a string value for the format and takes no effect. Width and height inputs are measurements of the page in Portrait orientation.
type PdfMaroto ¶
type PdfMaroto struct { Pdf *gofpdf.Fpdf Math internal.Math Font internal.Font TextHelper internal.Text SignHelper internal.Signature Image internal.Image Code internal.Code TableListHelper internal.TableList // contains filtered or unexported fields }
PdfMaroto is the principal structure which implements Maroto abstraction
func (*PdfMaroto) AddPage ¶ added in v0.27.2
func (s *PdfMaroto) AddPage()
AddPage adds a new page in the PDF
func (*PdfMaroto) AddUTF8Font ¶ added in v0.27.2
func (*PdfMaroto) Base64Image ¶
func (s *PdfMaroto) Base64Image(base64 string, extension consts.Extension, prop ...props.Rect) error
Base64Image add an Image reading byte slices inside a cell. Defining Image properties.
func (*PdfMaroto) FileImage ¶
FileImage add an Image reading from disk inside a cell. Defining Image properties.
func (*PdfMaroto) GetCurrentOffset ¶ added in v0.27.2
GetCurrentOffset obtain the current offset in y axis
func (*PdfMaroto) GetCurrentPage ¶
GetCurrentPage obtain the current page index this can be used inside a RegisterFooter/RegisterHeader to draw the current page, or to another purposes
func (*PdfMaroto) GetPageMargins ¶ added in v0.27.2
GetPageMargins returns the set page margins. Comes in order of Left, Top, Right, Bottom Default page margins is left: 10, top: 10, right: 10
func (*PdfMaroto) GetPageSize ¶
GetPageSize return the actual page size
func (*PdfMaroto) OutputFileAndClose ¶
OutputFileAndClose save pdf in disk.
func (*PdfMaroto) RegisterFooter ¶
func (s *PdfMaroto) RegisterFooter(closure func())
RegisterFooter define a sequence of Rows, Lines ou TableLists which will be added in every new page
func (*PdfMaroto) RegisterHeader ¶
func (s *PdfMaroto) RegisterHeader(closure func())
RegisterHeader define a sequence of Rows, Lines ou TableLists which will be added in every new page
func (*PdfMaroto) SetBackgroundColor ¶ added in v0.27.2
SetBackgroundColor define the background color of the PDF. This method can be used to toggle background from rows
func (*PdfMaroto) SetBorder ¶
SetBorder enable the draw of lines in every cell. Draw borders in all columns created.
func (*PdfMaroto) SetPageMargins ¶ added in v0.27.2
SetPageMargins overrides default margins (10,10,10) the new page margin will affect all PDF pages
func (*PdfMaroto) SetProtection ¶ added in v0.27.2
func (*PdfMaroto) Signature ¶
Signature add a space for a signature inside a cell, the space will have a line and a text below