pdfdraw

package module
v0.0.0-...-4e62a26 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2011 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package pdfdraw implements a library for rendering and reading PDFs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Backends

func Backends() (names []string)

Get a list of all available backends

func RegisterBackend

func RegisterBackend(name string, opener BackendOpener)

Register a new pdfdraw backend

Types

type BackendOpener

type BackendOpener func(path string) (doc Document, err error)

A BackendOpener is a function that can be used to open a Document using a specific backend

type Document

type Document interface {
	// Get the total number of pages in the Document
	NumPages() int
	// Get a Page
	Page(idx int) Page
}

Document represents a PDF document

func Open

func Open(path string) (doc Document, err error)

Open a PDF document using the default backend

func OpenBackend

func OpenBackend(path string, backend string) (doc Document, err error)

Open a PDF document using a specific backend

type Page

type Page interface {
	// Get the internal size of the Page
	Size() (width float64, height float64)
	// Render the page to an image.Image
	Render(width int, height int, opts *RenderOptions) image.Image
}

Page represents a page in a Document

type RenderOptions

type RenderOptions struct {
	// The color to fill the image with before it is drawn.
	FillColor color.RGBA

	// Disable anti-aliasing
	NoAA bool
}

RenderOptions specifies a set of options for rendering a page.

Jump to

Keyboard shortcuts

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