document

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Document

type Document struct {
	Orientation  string `json:"orientation"`
	PageSize     string `json:"pageSize"`
	MarginBottom uint   `json:"marginBottom"`
	MarginTop    uint   `json:"marginTop"`
	MarginLeft   uint   `json:"marginLeft"`
	MarginRight  uint   `json:"marginRight"`
}

Document refers the information of page viewing

type PDF

type PDF struct {
	// contains filtered or unexported fields
}

PDF is structure of PDF generator

func NewPDF

func NewPDF() (*PDF, error)

NewPDF return PDF generator

func (*PDF) AddPage

func (pdf *PDF) AddPage(input io.Reader)

AddPage generates PDF pages from reader

func (*PDF) AddPageFromString

func (pdf *PDF) AddPageFromString(content string)

AddPageFromString generates PDF pages including string

func (*PDF) AddPageFromURL

func (pdf *PDF) AddPageFromURL(url string)

AddPageFromURL generates PDF pages from URL

func (*PDF) Render

func (pdf *PDF) Render(writer io.Writer) error

Render creates PDF to writer

func (*PDF) RenderByContent

func (pdf *PDF) RenderByContent(writer io.Writer, content string) error

RenderByContent creates PDF from content to writer

func (*PDF) RenderByTemplate

func (pdf *PDF) RenderByTemplate(writer io.Writer, templateName string, data template.Context) error

RenderByTemplate creates PDF from template and data to writer

func (*PDF) RenderByVirtualTemplate

func (pdf *PDF) RenderByVirtualTemplate(writer io.Writer, templateContent string, data template.Context) error

RenderByVirtualTemplate creates PDF from specified template content and data to writer

func (*PDF) SetOptions

func (pdf *PDF) SetOptions(option Document)

SetOptions settle margin and page size of PDF

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL