document

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: BSD-3-Clause Imports: 4 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 creates a PDF file with the provided file name, initializes a new boxes and glue frontend document and loads a default CSS stylesheet.

func NewWithFrontend

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

NewWithFrontend creates a document from a boxes and glue frontend document and a csshtml CSS parser. The default fonts for the families monospace, sans and serif are loaded.

func (*Document) AddCSS

func (d *Document) AddCSS(css string) error

AddCSS reads the CSS instructions from a string.

func (*Document) Finish

func (d *Document) Finish() error

Finish writes and closes the PDF.

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() (htmlbag.PageDimensions, error)

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

func (*Document) ReadCSSFile

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

ReadCSSFile parses the CSS file at the filename.

Jump to

Keyboard shortcuts

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