Help us shape the future of Go! Take the 2026 Go Developer Survey

poppler

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: GPL-2.0 Imports: 5 Imported by: 4

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 Annot added in v0.0.2

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

func (*Annot) Close added in v0.0.2

func (a *Annot) Close()

type Color

type Color struct {
	R, G, B int
}

type Document

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

func Load

func Load(data []byte) (doc *Document, err error)

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

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) AnnotText added in v0.0.2

func (p *Page) AnnotText(a Annot) string

func (*Page) Close

func (p *Page) Close()

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) GetAnnots added in v0.0.2

func (p *Page) GetAnnots() (Annots []Annot)

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