pdf

package
v0.0.0-...-c077e1a Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func Writer

func Writer(w io.Writer, c *canvas.Canvas) error

Writer writes the canvas as a PDF file. DEPRECATED

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 (*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