Skip to content

Repository files navigation

pdfast

Pure-Go PDF reader — open, extract text/content, optional security stratum, sanitize rewrite.

CGO_ENABLED=0. Selected C libraries are transpiled with ccgo (blobs under internal/, linux/amd64).

Not a writer. For Markdown → PDF/office, see DoWi55 (hpdf55).

go get github.com/hazyhaar/pdfast@latest
import "github.com/hazyhaar/pdfast"

doc, err := pdfast.OpenFile(path)
doc, err := pdfast.OpenFile(path, pdfast.WithSecurity(true)) // untrusted

pages, err := pdfast.ExtractContent(ctx, doc)
pages, err := pdfast.ExtractText(ctx, doc)
out, err := pdfast.Saniscribe(ctx, doc)

Capabilities

Default open Core structural engine (no full-file active scan)
WithSecurity(true) Active-content scan + obliterate/reject policy
ExtractContent Decompressed page content streams
ExtractText Native text extract
Saniscribe Rewrite cleaned PDF bytes
Encrypt / polyglot Fail at open

Contract: V1.md. Engines: docs/ENGINES.md.

Transpiled decode helpers

Package Upstream Role
internal/truetype stb_truetype Font metrics / cmap
internal/clexer stb_c_lexer Script tokenization (security)
internal/tinyexpr tinyexpr Type 4 functions
internal/stbimage stb_image Image decode, flate fallback
internal/ccittfax CCITT Fax /CCITTFaxDecode

Do not hand-edit a_linux_amd64.go files.

Status

V1 reader path is the product focus. Re-run benches before publishing speed claims. Default path ≠ security mode cost.

License

MIT — Copyright (c) 2026 hazyhaar

Upstream C (stb, tinyexpr, …) retain original licenses; see blob headers.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages