pdf

package
v0.0.49 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsurePdfcpuInit

func EnsurePdfcpuInit()

EnsurePdfcpuInit initializes pdfcpu's global state exactly once. This must be called before any concurrent use of pdfcpu's NewDefaultConfiguration(). Safe to call from multiple goroutines; only the first call does work.

func EnsurePdfiumPoolInit added in v0.0.21

func EnsurePdfiumPoolInit() error

EnsurePdfiumPoolInit initializes the go-pdfium WASM pool if not already done. Safe to call multiple times; initialization happens at most once.

func Parse

func Parse(path string) (*mediafile.ParsedMetadata, error)

Parse reads metadata from a PDF file and returns it in the mediafile.ParsedMetadata format for compatibility with the existing scanner.

func PdfiumInstance added in v0.0.21

func PdfiumInstance(timeout time.Duration) (pdfium.Pdfium, error)

PdfiumInstance returns a pdfium instance from the shared WASM pool. The caller must call instance.Close() when done to return it to the pool.

func RenderPageJPEG added in v0.0.27

func RenderPageJPEG(path string, pageIdx int, dpi int, quality int) ([]byte, string, error)

RenderPageJPEG renders a single page of a PDF to JPEG using the shared pdfium WASM pool. pageIdx is 0-indexed.

Types

type OutlineEntry added in v0.0.21

type OutlineEntry struct {
	Title     string
	StartPage int // 0-indexed page number
}

OutlineEntry represents a single bookmark from a PDF's outline tree.

func ExtractOutline added in v0.0.21

func ExtractOutline(path string) ([]OutlineEntry, error)

ExtractOutline extracts the bookmark/outline tree from a PDF and returns a flat list of entries with their target page numbers. Returns nil (not an error) if the PDF has no bookmarks.

Jump to

Keyboard shortcuts

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