poppler

package module
v0.0.31 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: GPL-2.0 Imports: 6 Imported by: 0

README

go-poppler

Installation:

install poppler-glib and cairo (for Debian/Ubuntu):
apt-get install libpoppler-glib-dev libcairo2-dev

install go package:
go get github.com/cheggaaa/go-poppler

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Version

func Version() string

Types

type Color

type Color struct {
	R, G, B int
}

type Document

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

func Open

func Open(filename string) (doc *Document, err error)

func (*Document) Close

func (d *Document) Close()

func (*Document) GetNAttachments

func (d *Document) GetNAttachments() int

func (*Document) GetNPages

func (d *Document) GetNPages() int

func (*Document) GetPage

func (d *Document) GetPage(i int) (page *Page)

func (*Document) HasAttachments

func (d *Document) HasAttachments() bool

func (*Document) Info

func (d *Document) Info() DocumentInfo

func (*Document) Split

func (d *Document) Split()

type DocumentInfo

type DocumentInfo struct {
	PdfVersion, Title, Author, Subject, KeyWords, Creator, Producer, Metadata string
	CreationDate, ModificationDate, Pages                                     int
	IsLinearized                                                              bool
}

type Image

type Image struct {
	Id   int
	Area Rectangle
	// contains filtered or unexported fields
}

func (*Image) GetSurface

func (im *Image) GetSurface() (cs *cairo.Surface)

type Page

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

func (*Page) Close

func (p *Page) Close()

func (*Page) ConvertToPNG

func (p *Page) ConvertToPNG(filename string)

Converts a page into PNG and saves to file. Inspired by https://github.com/dawbarton/pdf2svg

func (*Page) ConvertToSVG

func (p *Page) ConvertToSVG(filename string)

Converts a page into SVG and saves to file. Inspired by https://github.com/dawbarton/pdf2svg

func (*Page) Duration

func (p *Page) Duration() float64

func (*Page) Images

func (p *Page) Images() (results []Image)

func (*Page) Index

func (p *Page) Index() int

func (*Page) Label

func (p *Page) Label() string

func (*Page) Size

func (p *Page) Size() (width, height float64)

func (*Page) Text

func (p *Page) Text() string

func (*Page) TextAttributes

func (p *Page) TextAttributes() (results []TextAttributes)

func (*Page) TextLayout

func (p *Page) TextLayout() (layouts []Rectangle)

func (*Page) TextLayoutAndAttrs

func (p *Page) TextLayoutAndAttrs() (result []TextEl)

type Rectangle

type Rectangle struct {
	X1, Y1, X2, Y2 float64
}

type TextAttributes

type TextAttributes struct {
	FontName             string
	FontSize             float64
	IsUnderlined         bool
	Color                Color
	StartIndex, EndIndex int
}

type TextEl

type TextEl struct {
	Text  string
	Attrs *TextAttributes
	Rect  Rectangle
}

Jump to

Keyboard shortcuts

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