optimize

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: AGPL-3.0, AGPL-3.0-only Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chain

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

Chain allows to use sequence of optimizers. It implements interface model.Optimizer.

func New

func New(options Options) *Chain

New creates a optimizers chain from options.

func (*Chain) Append

func (c *Chain) Append(optimizers ...model.Optimizer)

Append appends optimizers to the chain.

func (*Chain) Optimize

func (c *Chain) Optimize(objects []core.PdfObject) (optimizedObjects []core.PdfObject, err error)

Optimize optimizes PDF objects to decrease PDF size.

type CombineDuplicateDirectObjects

type CombineDuplicateDirectObjects struct {
}

CombineDuplicateDirectObjects combines duplicated direct objects by its data hash. It implements interface model.Optimizer.

func (*CombineDuplicateDirectObjects) Optimize

func (dup *CombineDuplicateDirectObjects) Optimize(objects []core.PdfObject) (optimizedObjects []core.PdfObject, err error)

Optimize optimizes PDF objects to decrease PDF size.

type CombineDuplicateStreams

type CombineDuplicateStreams struct {
}

CombineDuplicateStreams combines duplicated streams by its data hash. It implements interface model.Optimizer.

func (*CombineDuplicateStreams) Optimize

func (dup *CombineDuplicateStreams) Optimize(objects []core.PdfObject) (optimizedObjects []core.PdfObject, err error)

Optimize optimizes PDF objects to decrease PDF size.

type CombineIdenticalIndirectObjects

type CombineIdenticalIndirectObjects struct {
}

CombineIdenticalIndirectObjects combines identical indirect objects. It implements interface model.Optimizer.

func (*CombineIdenticalIndirectObjects) Optimize

func (c *CombineIdenticalIndirectObjects) Optimize(objects []core.PdfObject) (optimizedObjects []core.PdfObject, err error)

Optimize optimizes PDF objects to decrease PDF size.

type CompressStreams

type CompressStreams struct {
}

CompressStreams compresses uncompressed streams. It implements interface model.Optimizer.

func (*CompressStreams) Optimize

func (c *CompressStreams) Optimize(objects []core.PdfObject) (optimizedObjects []core.PdfObject, err error)

Optimize optimizes PDF objects to decrease PDF size.

type Image

type Image struct {
	ImageQuality int
}

Image optimizes images by rewrite images into JPEG format with quality equals to ImageQuality. TODO(a5i): Add support for inline images. It implements interface model.Optimizer.

func (*Image) Optimize

func (i *Image) Optimize(objects []core.PdfObject) (optimizedObjects []core.PdfObject, err error)

Optimize optimizes PDF objects to decrease PDF size.

type ImagePPI

type ImagePPI struct {
	ImageUpperPPI float64
}

ImagePPI optimizes images by scaling images such that the PPI (pixels per inch) is never higher than ImageUpperPPI. TODO(a5i): Add support for inline images. It implements interface model.Optimizer.

func (*ImagePPI) Optimize

func (i *ImagePPI) Optimize(objects []core.PdfObject) (optimizedObjects []core.PdfObject, err error)

Optimize optimizes PDF objects to decrease PDF size.

type ObjectStreams

type ObjectStreams struct {
}

ObjectStreams groups PDF objects to object streams. It implements interface model.Optimizer.

func (*ObjectStreams) Optimize

func (o *ObjectStreams) Optimize(objects []core.PdfObject) (optimizedObjects []core.PdfObject, err error)

Optimize optimizes PDF objects to decrease PDF size.

type Options

type Options struct {
	CombineDuplicateStreams         bool
	CombineDuplicateDirectObjects   bool
	ImageUpperPPI                   float64
	ImageQuality                    int
	UseObjectStreams                bool
	CombineIdenticalIndirectObjects bool
	CompressStreams                 bool
}

Options describes PDF optimization parameters.

Jump to

Keyboard shortcuts

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