pdf

package
v0.0.0-...-95f003d Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 18 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultOptions = Options{
	Compress:      true,
	SubsetFonts:   true,
	ImageEncoding: canvas.Lossless,
}

Functions

This section is empty.

Types

type Options

type Options struct {
	Compress    bool
	SubsetFonts bool
	canvas.ImageEncoding
}

type PDF

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

PDF is a portable document format renderer.

func New

func New(w io.Writer, width, height float64, opts *Options) *PDF

New returns a portable document format (PDF) renderer.

func (r *PDF) AddLink(uri string, rect canvas.Rect)

AddLink adds a link to the PDF document.

func (*PDF) Close

func (r *PDF) Close() error

Close finished and closes the PDF.

func (*PDF) NewPage

func (r *PDF) NewPage(width, height float64)

NewPage starts adds a new page where further rendering will be written to.

func (*PDF) RenderImage

func (r *PDF) RenderImage(img image.Image, m canvas.Matrix)

RenderImage renders an image to the canvas using a transformation matrix.

func (*PDF) RenderPath

func (r *PDF) RenderPath(path *canvas.Path, style canvas.Style, m canvas.Matrix)

RenderPath renders a path to the canvas using a style and a transformation matrix.

func (*PDF) RenderText

func (r *PDF) RenderText(text *canvas.Text, m canvas.Matrix)

RenderText renders a text object to the canvas using a transformation matrix.

func (*PDF) SetImageEncoding

func (r *PDF) SetImageEncoding(enc canvas.ImageEncoding)

SetImageEncoding sets the image encoding to Loss or Lossless.

func (*PDF) SetInfo

func (r *PDF) SetInfo(title, subject, keywords, author, creator string)

SetInfo sets the document's title, subject, keywords, author and creator.

func (*PDF) Size

func (r *PDF) Size() (float64, float64)

Size returns the size of the canvas in millimeters.

Jump to

Keyboard shortcuts

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