pdf

package
v5.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Link struct {
	Bounds     unison.Rect
	PageNumber int
	URI        string
}

Link holds a single link on a page. If PageNumber if >= 0, then this is an internal link and the URI will be empty.

type PDF

type PDF struct {
	MaxSearchMatches   int
	PPI                int
	DisplayScaleAdjust float32
	// contains filtered or unexported fields
}

PDF holds a PDF page renderer.

func New

func New(filePath string, pageLoadedCallback func()) (*PDF, error)

New creates a new PDF page renderer.

func (*PDF) CurrentPage

func (p *PDF) CurrentPage() *Page

CurrentPage returns the currently rendered page.

func (*PDF) LoadPage

func (p *PDF) LoadPage(pageNumber int, scale float32, search string)

LoadPage requests the given page to be loaded and rendered at the specified scale.

func (*PDF) MostRecentPageNumber

func (p *PDF) MostRecentPageNumber() int

MostRecentPageNumber returns the most recent page number that has been asked to be rendered.

func (*PDF) PageCount

func (p *PDF) PageCount() int

PageCount returns the total page count.

func (*PDF) RenderingFinished

func (p *PDF) RenderingFinished() (finished bool, pageNumber int, requested time.Time)

RenderingFinished returns true if there is no rendering being done for this PDF at the moment.

func (*PDF) RequestRenderPriority

func (p *PDF) RequestRenderPriority()

RequestRenderPriority attempts to bump this PDF's rendering to the head of the queue.

type Page

type Page struct {
	Error      error
	PageNumber int
	Image      *unison.Image
	TOC        []*TOC
	Links      []*Link
	Matches    []unison.Rect
}

Page holds a rendered PDF page.

type TOC

type TOC struct {
	Title        string
	PageNumber   int
	PageLocation unison.Point
	Children     []*TOC
}

TOC holds a table of contents entry.

Jump to

Keyboard shortcuts

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