document

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: BSD-3-Clause 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 {
	Title    string
	Author   string
	Keywords string // separated by comma
	Creator  string
	Subject  string
	Frontend *frontend.Document
	// contains filtered or unexported fields
}

Document is the main starting point of the PDF generation.

func New

func New(filename string) (*Document, error)

New writes the PDF

func NewWithFrontend

func NewWithFrontend(fe *frontend.Document, cssparser *csshtml.CSS) *Document

NewWithFrontend creates a document with a boxes and glue frontend document.

func (*Document) AddCSS

func (d *Document) AddCSS(css string)

AddCSS permanently adds the css instructions to the current state.

func (*Document) CreateVlist

func (d *Document) CreateVlist(te *frontend.Text, wd bag.ScaledPoint) (*node.VList, error)

CreateVlist returns a single vertical list ready to be placed in the PDF.

func (*Document) Finish

func (d *Document) Finish() error

Finish writes and closes the PDF.

func (*Document) HTMLToText

func (d *Document) HTMLToText(html string) (*frontend.Text, error)

HTMLToText interprets the HTML string and applies all previously read CSS data.

func (*Document) NextPage

func (d *Document) NextPage() error

NextPage adds a new page

func (*Document) OutputAt

func (d *Document) OutputAt(html string, width bag.ScaledPoint, x, y bag.ScaledPoint) error

OutputAt writes the HTML string to the PDF.

func (*Document) PageSize

func (d *Document) PageSize() (cssbuilder.PageDimensions, error)

PageSize returns a struct with the dimensions of the current page.

func (*Document) ParseHTMLFromNode

func (d *Document) ParseHTMLFromNode(html *html.Node) (*frontend.Text, error)

ParseHTMLFromNode interprets the HTML structure and applies all previously read CSS data.

func (*Document) ReadCSSFile

func (d *Document) ReadCSSFile(filename string) error

ReadCSSFile parses the CSS file at the filename.

func (*Document) ShowCSS

func (d *Document) ShowCSS() string

ShowCSS dumps the currently known CSS to a CSS like string

Jump to

Keyboard shortcuts

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