pdf

package
v0.0.0-...-03d6fc4 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2019 License: BSD-3-Clause Imports: 8 Imported by: 0

README

PDF Rasterizer Package

For the tests in this package to work, PDFium and Poppler have to be installed.

To install the pdfium_test executable run the infra/pdfium/install_pdfium.sh script.

To install Poppler use the package manager of your system. On Ubuntu use this command:

$ sudo apt-get install poppler-utils netpbm

Documentation

Overview

PDF Rasterizer

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pdfium

type Pdfium struct{}

func (Pdfium) Enabled

func (Pdfium) Enabled() bool

func (Pdfium) Rasterize

func (Pdfium) Rasterize(pdfInputPath, pngOutputPath string) error

Rasterize assumes that filepath.Dir(pdfInputPath) is writable

func (Pdfium) String

func (Pdfium) String() string

type Poppler

type Poppler struct{}

func (Poppler) Enabled

func (Poppler) Enabled() bool

func (Poppler) Rasterize

func (Poppler) Rasterize(pdfInputPath, pngOutputPath string) error

This does the following:

`pdftoppm -r 72 -f 1 -l 1 < $PDF 2>/dev/null | pnmtopng 2> /dev/null > $PNG`

func (Poppler) String

func (Poppler) String() string

type Rasterizer

type Rasterizer interface {
	// Rasterize will take the path to a PDF file and rasterize the
	// file.  If the file has multiple pages, discard all but the first
	// page.  The output file will be in PNG format.
	Rasterize(pdfInputPath, pngOutputPath string) error
	// Return the name of this rasterizer.
	String() string
	// Return false if the rasterizer is found.
	Enabled() bool
}

func GetEnabledRasterizers

func GetEnabledRasterizers() []Rasterizer

GetEnabledRasterizers returns the list of enabled rasterizers based on the executables installed on the host machine.

Jump to

Keyboard shortcuts

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