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

poppler

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 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()

func (*Annot) Color added in v0.0.3

func (a *Annot) Color() Color

func (*Annot) Contents added in v0.0.3

func (a *Annot) Contents() string

func (*Annot) Date added in v0.0.3

func (a *Annot) Date() string

func (*Annot) Flags added in v0.0.3

func (a *Annot) Flags() AnnotFlag

func (*Annot) Index added in v0.0.3

func (a *Annot) Index() int

func (*Annot) Name added in v0.0.3

func (a *Annot) Name() string

func (*Annot) Quads added in v0.0.3

func (a *Annot) Quads() []Quad

func (*Annot) Rect added in v0.0.3

func (a *Annot) Rect() Rectangle

func (*Annot) SetColor added in v0.0.4

func (a *Annot) SetColor(c Color)

func (*Annot) SetContents added in v0.0.4

func (a *Annot) SetContents(c string)

func (*Annot) SetFlags added in v0.0.4

func (a *Annot) SetFlags(f AnnotFlag)

func (*Annot) Type added in v0.0.3

func (a *Annot) Type() AnnotType

type AnnotFlag added in v0.0.3

type AnnotFlag int
const (
	AnnotFlagUnknown AnnotFlag = 1 << iota
	AnnotFlagInvisible
	AnnotFlagHidden
	AnnotFlagPrint
	AnnotFlagNoZoom
	AnnotFlagNoRotate
	AnnotFlagNoView
	AnnotFlagReadOnly
	AnnotFlagLocked
	AnnotFlagToggleNoView
	AnnotFlagLockedContents
)

type AnnotType added in v0.0.3

type AnnotType int
const (
	AnnotUnknown AnnotType = iota
	AnnotText
	AnnotLink
	AnnotFreeText
	AnnotLine
	AnnotSquare
	AnnotCircle
	AnnotPolygon
	AnnotPolyLine
	AnnotHighlight
	AnnotUnderline
	AnnotSquiggly
	AnnotStrikeOut
	AnnotStamp
	AnnotCaret
	AnnotInk
	AnnotPopup
	AnnotFileAttachment
	AnnotSound
	AnnotMovie
	AnnotWidget
	AnnotScreen
	AnnotPrinterMark
	AnnotTrapNet
	AnnotWatermark
	Annot3D
)

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

func (*Document) NewAnnot added in v0.0.4

func (d *Document) NewAnnot(t AnnotType, r Rectangle, q []Quad) (Annot, error)

func (*Document) Save added in v0.0.4

func (d *Document) Save(filename string) (saved bool, err error)

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) AddAnnot added in v0.0.4

func (p *Page) AddAnnot(a Annot)

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) RemoveAnnot added in v0.0.4

func (p *Page) RemoveAnnot(a Annot)

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 Point added in v0.0.3

type Point struct {
	X, Y float64
}

type Quad added in v0.0.3

type Quad struct {
	P1, P2, P3, P4 Point
}

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