optimize

package
v3.0.0-...-55e877b Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2023 License: GPL-2.0 Imports: 13 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 (_gef *Chain) Append(optimizers ..._g.Optimizer)

Append appends optimizers to the chain.

func (*Chain) Optimize

func (_geg *Chain) Optimize(objects []_ge.PdfObject) (_gb []_ge.PdfObject, _gefd error)

Optimize optimizes PDF objects to decrease PDF size.

type CleanContentstream

type CleanContentstream struct{}

CleanContentstream cleans up redundant operands in content streams, including Page and XObject Form contents. This process includes: 1. Marked content operators are removed. 2. Some operands are simplified (shorter form). TODO: Add more reduction methods and improving the methods for identifying unnecessary operands.

func (*CleanContentstream) Optimize

func (_fe *CleanContentstream) Optimize(objects []_ge.PdfObject) (_cf []_ge.PdfObject, _fae error)

Optimize optimizes PDF objects to decrease PDF size.

type CleanFonts

type CleanFonts struct {

	// Subset embedded fonts if encountered (if true).
	// Otherwise attempts to reduce the font program.
	Subset bool
}

CleanFonts cleans up embedded fonts, reducing font sizes.

func (*CleanFonts) Optimize

func (_aac *CleanFonts) Optimize(objects []_ge.PdfObject) (_fge []_ge.PdfObject, _aec 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 (_eb *CombineDuplicateDirectObjects) Optimize(objects []_ge.PdfObject) (_ceg []_ge.PdfObject, _ad 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 (_aga *CombineDuplicateStreams) Optimize(objects []_ge.PdfObject) (_gba []_ge.PdfObject, _caf 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 (_faef *CombineIdenticalIndirectObjects) Optimize(objects []_ge.PdfObject) (_fcee []_ge.PdfObject, _abc 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 (_cgg *CompressStreams) Optimize(objects []_ge.PdfObject) (_feff []_ge.PdfObject, _eda 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 (_gagb *Image) Optimize(objects []_ge.PdfObject) (_aeg []_ge.PdfObject, _fdgb 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 (_cggc *ImagePPI) Optimize(objects []_ge.PdfObject) (_gdgb []_ge.PdfObject, _aab 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 (_dbabd *ObjectStreams) Optimize(objects []_ge.PdfObject) (_gaac []_ge.PdfObject, _gcff 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
	CleanFonts                      bool
	SubsetFonts                     bool
	CleanContentstream              bool
}

Options describes PDF optimization parameters.

Directories

Path Synopsis
Package tests provides integration tests for the UniPDF optimizer.
Package tests provides integration tests for the UniPDF optimizer.

Jump to

Keyboard shortcuts

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