Documentation ¶
Overview ¶
*
- library qpdf
- is an extention to github.com/johnfercher/maroto *
- maroto use grid system to handle table form, but due to it is still complexity to general usage
- therefore, the objective to opdf is to provide a simple solution for table list pdf documet generator *
- this library defines below strcuture for generating pdf forms *
- - AbstractTable
- a half page width table, as an abstraction table use case *
- - TableForm
- for data listing table usecase, *
- detail information could see libs/qpdf/props.go *
- how to use this library, you can see libs/qpdf/example/example.go *
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrLackOfInit means lack of pdf file initial ErrLackOfInit = errors.New("please initial a pdf, by Initial") // ErrLoadImageByURL means read image by url has error ErrLoadImageByURL = errors.New("load image by given url failed") // ErrImageRead means image decode process has error ErrImageRead = errors.New("image read from url error") // ErrImageWrite means ioutil write image has error ErrImageWrite = errors.New("ioutil write image has error") // ErrExportByte means export pdf []byte failure ErrExportByte = errors.New("export pdf in byte array failed") )
Functions ¶
This section is empty.
Types ¶
type AbstractTable ¶
type AbstractTable struct { Height float64 Width float64 Rows []*AbstractRow }
AbstractTable is special table for describe page, or document's abstraction format *
- Abstract Table
- ---------------------------
- title | content | <-- AbstractRow
- ---------------------------
- title2 | content |
- ---------------------------
- title2 | content |
- ---------------------------
func (*AbstractTable) LongestStr ¶
func (at *AbstractTable) LongestStr() (titleLen float64, contentLen float64)
type FooterTable ¶
type FooterTable struct {
}type HeaderTable ¶
HeaderTable decsribe header format
type Orientation ¶
type Orientation string
Orientation describe pdf file layout orientation
const ( Portrait Orientation = "P" Landscape Orientation = "L" )
type PDF ¶
type PDF interface { // Initial to Initial a pdf Initial(ctx ctx.CTX, orientation Orientation, pageSize PageSize) (err error) // SetHeader to set document header SetHeader(ctx ctx.CTX, header *HeaderTable) (err error) SetFooter(ctx ctx.CTX, footer *FooterTable) (err error) // AppendAbstractTable to append an abstrct table on current page AppendAbstractTable(ctx ctx.CTX, table *AbstractTable) (err error) // AppendTable to append a table collection on current page AppendTable(ctx ctx.CTX, table *TableForm) (err error) // AddPage to add a new page in PDF AddPage(ctx ctx.CTX) (err error) // GetPDFbyte to get pdf content (byte) GetPDFbyte(ctx ctx.CTX) (pdfContent []byte, err error) // Save to close pdf file, and save in temp location Save(ctx ctx.CTX, filename string) (tempPath string, err error) }
type PageSize ¶
type PageSize string
PageSize to define document page size
const (
A4 PageSize = "A4"
)
Click to show internal directories.
Click to hide internal directories.