Versions in this module Expand all Collapse all v1 v1.1.0 Jun 3, 2026 v1.0.0 Jun 2, 2026 Changes in this version + const LabelAlphaLower + const LabelAlphaUpper + const LabelDecimal + const LabelRomanLower + const LabelRomanUpper + type AnnotStyle struct + Fill *[3]float64 + Opacity float64 + Stroke *[3]float64 + Width float64 + type Annotation struct + Contents string + Index int + Rect geometry.Rect + Type string + type Char struct + BBox geometry.Rect + Origin geometry.Point + Rune rune type Document + func OpenAny(filename string) (*Document, error) + func OpenAnyStream(data []byte, filetype string) (*Document, error) + func (d *Document) ConvertToPDF() (*Document, error) + func (d *Document) CopyPage(from, to int) error + func (d *Document) DeleteXMP() error + func (d *Document) ExtractFont(xref int) (name, ext string, data []byte, err error) + func (d *Document) EzSave(path string) error + func (d *Document) InsertPDFRange(src []byte, fromPage, toPage int, password string) error + func (d *Document) MovePage(from, to int) error + func (d *Document) PageLabels() ([]PageLabel, error) + func (d *Document) SaveBytesWithOptions(opts SaveOptions) ([]byte, error) + func (d *Document) SaveIncremental(path string) error + func (d *Document) SaveWithOptions(path string, opts SaveOptions) error + func (d *Document) SelectPages(pages []int) error + func (d *Document) SetMetadata(meta map[string]string) error + func (d *Document) SetPageLabels(labels []PageLabel) error + func (d *Document) SetTOC(entries []TOCEntry) error + func (d *Document) SetXMP(xml string) error + func (d *Document) XMP() (string, error) + type DrawOptions struct + Fill *[3]float64 + Stroke *[3]float64 + Width float64 + type Font struct + func NewFont(name string) (*Font, error) + func (f *Font) Advance(r rune, size float64) float64 + func (f *Font) Ascender() float64 + func (f *Font) Close() + func (f *Font) Descender() float64 + func (f *Font) Name() string + func (f *Font) TextLength(text string, size float64) float64 + type FontInfo struct + Embedded bool + Encoding string + Name string + Type string + Xref int type Page + func (p *Page) AddCircle(r geometry.Rect, style AnnotStyle) error + func (p *Page) AddFreeText(r geometry.Rect, text string, size float64, style AnnotStyle) error + func (p *Page) AddHighlight(quads []geometry.Quad) error + func (p *Page) AddInk(strokes [][]geometry.Point, style AnnotStyle) error + func (p *Page) AddLine(a, b geometry.Point, style AnnotStyle) error + func (p *Page) AddPolygon(pts []geometry.Point, style AnnotStyle) error + func (p *Page) AddPolyline(pts []geometry.Point, style AnnotStyle) error + func (p *Page) AddRedaction(rect geometry.Rect, opts RedactOptions) error + func (p *Page) AddSquiggly(quads []geometry.Quad) error + func (p *Page) AddStrikeout(quads []geometry.Quad) error + func (p *Page) AddTextField(name string, rect geometry.Rect, value string) error + func (p *Page) AddTextNote(at geometry.Point, text string) error + func (p *Page) AddUnderline(quads []geometry.Quad) error + func (p *Page) Annotations() ([]Annotation, error) + func (p *Page) ApplyRedactions() (int, error) + func (p *Page) CropBox() (geometry.Rect, error) + func (p *Page) DeleteAnnotation(index int) error + func (p *Page) DeleteLink(index int) error + func (p *Page) Dict() ([]RawBlock, error) + func (p *Page) DrawCircle(center geometry.Point, radius float64, opts DrawOptions) error + func (p *Page) DrawLine(a, b geometry.Point, opts DrawOptions) error + func (p *Page) DrawRect(r geometry.Rect, opts DrawOptions) error + func (p *Page) ExtractText(opts TextOptions) (string, error) + func (p *Page) GetFonts() ([]FontInfo, error) + func (p *Page) HTML() (string, error) + func (p *Page) InsertGotoLink(rect geometry.Rect, destPage int) error + func (p *Page) InsertLink(rect geometry.Rect, uri string) error + func (p *Page) InsertTextbox(rect geometry.Rect, text string, size float64) (int, error) + func (p *Page) Label() (string, error) + func (p *Page) MediaBox() (geometry.Rect, error) + func (p *Page) RawDict() ([]RawBlock, error) + func (p *Page) Rotation() (int, error) + func (p *Page) SearchWith(needle string, opts SearchOptions) ([]geometry.Quad, error) + func (p *Page) SetCheckbox(index int, checked bool) error + func (p *Page) SetCropBox(r geometry.Rect) error + func (p *Page) SetMediaBox(r geometry.Rect) error + func (p *Page) SetRotation(deg int) error + func (p *Page) SetTextField(index int, value string) error + func (p *Page) Widgets() ([]Widget, error) + func (p *Page) XHTML() (string, error) + func (p *Page) XML() (string, error) + type PageLabel struct + Prefix string + Start int + StartPage int + Style string type Pixmap + func (pm *Pixmap) Bytes(format string) ([]byte, error) + func (pm *Pixmap) Gamma(gamma float64) + func (pm *Pixmap) Invert() + func (pm *Pixmap) JPEG(quality int) ([]byte, error) + func (pm *Pixmap) PNM() ([]byte, error) + func (pm *Pixmap) Save(path string) error type PixmapOptions + CMYK bool + Clip *geometry.Rect + DPI float64 + NoAnnots bool + type RawBlock struct + BBox geometry.Rect + Lines []TextLine + Spans []TextSpan + type RedactOptions struct + Fill *[3]float64 + RemoveImages bool + type SaveOptions struct + ASCII bool + Clean bool + Deflate bool + DeflateFonts bool + DeflateImages bool + Encrypt bool + Garbage int + Incremental bool + Linear bool + OwnerPassword string + Permissions int + Pretty bool + UserPassword string + func DefaultSaveOptions() SaveOptions + type SearchOptions struct + Clip *geometry.Rect + MaxHits int type Table + func (t *Table) Header() []string + func (t *Table) ToMarkdown() string + type TextLine struct + BBox geometry.Rect + Chars []Char + type TextOptions struct + Clip *geometry.Rect + Dehyphenate bool + InhibitSpaces bool + PreserveImages bool + PreserveLigatures bool + PreserveWhitespace bool + type TextSpan struct + BBox geometry.Rect + Font string + Size float64 + Text string + type Widget struct + Index int + Name string + Rect geometry.Rect + Type string + Value string v0 v0.1.1 Jun 2, 2026 v0.1.0 Jun 2, 2026 Changes in this version + type Block struct + BBox Rect + Spans []Span + Type string + type Document struct + func NewPDF() (*Document, error) + func Open(filename string) (*Document, error) + func OpenStream(pdf []byte) (*Document, error) + func OpenStreamWithPassword(pdf []byte, password string) (*Document, error) + func OpenWithPassword(filename, password string) (*Document, error) + func (d *Document) AllLines() ([]string, error) + func (d *Document) Authenticate(password string) bool + func (d *Document) Close() + func (d *Document) DeletePage(n int) error + func (d *Document) InsertPDF(src []byte, password string) error + func (d *Document) IsEncrypted() bool + func (d *Document) LoadPage(i int) (*Page, error) + func (d *Document) Metadata() (map[string]string, error) + func (d *Document) NeedsPass() bool + func (d *Document) NewPage(width, height float64) error + func (d *Document) PageCount() int + func (d *Document) Pages() iter.Seq2[int, *Page] + func (d *Document) Save(path string, garbage bool) error + func (d *Document) SaveBytes(garbage bool) ([]byte, error) + func (d *Document) SaveEncryptedBytes(userPwd, ownerPwd string) ([]byte, error) + func (d *Document) TOC() ([]TOCEntry, error) + func (d *Document) Text() (string, error) + func (d *Document) TextByPage() ([]string, error) + type Drawing struct + Alpha float64 + Color [3]float64 + Items []PathItem + LineJoin int + Rect geometry.Rect + Type string + Width float64 + type ExtractedImage struct + Bytes []byte + Ext string + type ImageInfo struct + BBox geometry.Rect + BPC int + Ext string + Height int + Index int + N int + Width int + type Link struct + Rect geometry.Rect + URI string + type Page struct + Number int + func (p *Page) AddRectAnnot(r geometry.Rect) error + func (p *Page) Bound() (geometry.Rect, error) + func (p *Page) ExtractImage(index int) (*ExtractedImage, error) + func (p *Page) FindTables(opts ...TableSettings) ([]Table, error) + func (p *Page) GetDrawings() ([]Drawing, error) + func (p *Page) GetImages() ([]ImageInfo, error) + func (p *Page) GetText() (string, error) + func (p *Page) InsertImage(r geometry.Rect, img []byte) error + func (p *Page) InsertText(x, y, size float64, text string) error + func (p *Page) Lines() ([]string, error) + func (p *Page) Links() ([]Link, error) + func (p *Page) Pixmap(opts ...PixmapOptions) (*Pixmap, error) + func (p *Page) Search(needle string) ([]geometry.Quad, error) + func (p *Page) SearchRects(needle string) ([]geometry.Rect, error) + func (p *Page) Spans() ([]Span, error) + func (p *Page) StructuredJSON() (string, error) + func (p *Page) StructuredText() ([]Block, error) + func (p *Page) Words() ([]Word, error) + type PathItem struct + Op string + Pts []geometry.Point + type Pixmap struct + Alpha bool + Height int + N int + Samples []byte + Stride int + Width int + func (pm *Pixmap) Image() (image.Image, error) + func (pm *Pixmap) PNG() ([]byte, error) + func (pm *Pixmap) Pixel(x, y int) []byte + func (pm *Pixmap) SavePNG(path string) error + type PixmapOptions struct + Alpha bool + Gray bool + Zoom float64 + type Rect struct + H float64 + W float64 + X float64 + Y float64 + func (r Rect) CenterY() float64 + func (r Rect) X1() float64 + func (r Rect) Y1() float64 + type Span struct + BBox Rect + FontName string + FontSize float64 + OriginX float64 + OriginY float64 + Text string + type TOCEntry struct + Level int + Page int + Title string + type Table struct + BBox Rect + ColX []float64 + RowY []float64 + Rows [][]string + func (t *Table) NumCols() int + func (t *Table) NumRows() int + type TableSettings struct + AlignTolerance float64 + IntersectionTol float64 + MinWordsHorizontal int + MinWordsVertical int + SnapTolerance float64 + Strategy TableStrategy + func DefaultTableSettings() TableSettings + type TableStrategy string + const StrategyLines + const StrategyText + type Word struct + BBox Rect + Block int + Line int + Text string