Skip to content

Releases: coregx/gxpdf

v0.6.0

24 Feb 23:43
648b20d

Choose a tag to compare

GxPDF v0.6.0 — Encrypted PDF Reading & Gradient Rendering

Two major features in this release: transparent reading of password-protected PDFs and full gradient rendering via PDF Shading dictionaries.

Highlights

  • Encrypted PDF Reading — open password-protected PDFs with Open() or OpenWithPassword() (#34)
  • Full Gradient Rendering — linear and radial gradients now render as real color transitions, not solid colors (#57)
  • ExtGState Fix — shape and text opacity produce valid PDF output (#46, #47)

What's New

Encrypted PDF Reading (#34)

Read PDFs encrypted with Standard Security Handler:

Algorithm Version Status
RC4 40-bit V=1, R=2 Supported
RC4 128-bit V=2, R=3 Supported
AES-128 V=4, R=4 Supported
  • Open() transparently handles empty-password encrypted PDFs (permissions-only — most common case)
  • OpenWithPassword() for PDFs with non-empty user passwords
  • ErrPasswordRequired sentinel error for wrong/missing password
// Permissions-only PDFs open transparently
doc, _ := gxpdf.Open("bank_statement.pdf")

// Password-protected PDFs
doc, err := gxpdf.OpenWithPassword("protected.pdf", "secret")
if errors.Is(err, gxpdf.ErrPasswordRequired) {
    log.Fatal("Wrong password")
}

Full Gradient Rendering (#57)

Gradients now render as real PDF Shading objects instead of solid-color fallback:

  • Linear gradients — ShadingType 2 (axial) with multi-stop support
  • Radial gradients — ShadingType 3 with focal point control
  • Multi-stop — Type 3 stitching functions for 3+ color stops
  • All shapes — rectangles, circles, ellipses, polygons, Bezier curves
grad := creator.NewLinearGradient(50, 650, 250, 650)
grad.AddColorStop(0, creator.Red)
grad.AddColorStop(0.5, creator.Yellow)
grad.AddColorStop(1, creator.Green)

page.DrawRect(50, 620, 200, 60, &creator.RectOptions{
    FillGradient: grad,
})

What's Fixed

  • ExtGState Object Creation — opacity on shapes and text now produces valid PDF indirect objects (#46, #47)

Installation

# CLI tool:
go install github.com/coregx/gxpdf/cmd/gxpdf@v0.6.0

# Library:
go get github.com/coregx/gxpdf@v0.6.0

Full Changelog: https://github.com/coregx/gxpdf/blob/main/CHANGELOG.md

v0.5.1

23 Feb 18:58
b19b7bd

Choose a tag to compare

v0.5.1 — ExtGState Hotfix

Fixes shape and text opacity producing invalid PDF output (#46, #47).

What was broken

ExtGState objects (used for transparency) were registered in the resource dictionary but never created as actual PDF objects. This caused /GS1 0 0 R references — PDF viewers silently ignored them, making all opacity settings invisible.

What's fixed

  • ExtGState indirect objects are now properly created with correct /ca and /CA opacity values
  • Both text-only and graphics+text rendering paths are fixed
  • All shape types affected: circles, rectangles, ellipses, polygons, lines, Bezier curves
  • Text opacity via AddTextColorAlpha and custom font variants

Upgrade

go get github.com/coregx/gxpdf@v0.5.1

v0.5.0

23 Feb 10:39
c934ee6

Choose a tag to compare

v0.5.0 — "Opacity & Bezier"

Third feature release adding transparency controls and quadratic Bezier curves.

Highlights

  • Text Opacity — render semi-transparent text for watermarks and overlays
  • Quadratic Bezier Curves — native quadratic curves with exact cubic conversion
  • Shape Opacity Fix — opacity on shapes now works correctly across all shape types

What's New

Text Opacity (#46)

New methods for rendering text with transparency via ExtGState (/ca, /CA):

page.AddTextColorAlpha("Watermark", 200, 400, creator.Helvetica, 48, creator.Gray, 0.3)

All variants supported:

  • AddTextColorAlpha — standard font + color + opacity
  • AddTextColorRotatedAlpha — with rotation
  • AddTextCustomFontColorAlpha — custom TTF/OTF font
  • AddTextCustomFontColorRotatedAlpha — custom font + rotation

Quadratic Bezier Curves (#45)

DrawQuadBezierCurve with multi-segment paths:

segments := []creator.QuadBezierSegment{
    {
        Start:   creator.Point{X: 100, Y: 100},
        Control: creator.Point{X: 150, Y: 200},
        End:     creator.Point{X: 250, Y: 100},
    },
}
page.DrawQuadBezierCurve(segments, &creator.BezierOptions{
    Color: creator.Blue, Width: 2.0,
})

Converts to cubic via exact degree elevation (PDF only supports cubic natively). seg.ToCubic() available for manual conversion. Full styling: stroke, fill, dash, opacity, gradients.

What's Fixed

Shape Opacity (#47)

The Opacity field on shape option structs (circles, ellipses, rectangles, polygons, polylines, lines, Bezier curves) was silently dropped during the creator→writer conversion. Fixed by propagating opacity through the full pipeline: convertOptionswriter.GraphicsOp → ExtGState gs operator.

Full Changelog

https://github.com/coregx/gxpdf/blob/main/CHANGELOG.md#050---2026-02-23-opacity--bezier

v0.4.0

21 Feb 07:47
1e84281

Choose a tag to compare

v0.4.0 — Creator API

Focused on Creator API enhancements requested by the community (#41, #42).

Highlights

  • 35+ built-in page sizes — ISO A/B/C, ANSI, photo, book, JIS, envelopes, presentation slides
  • Custom page dimensionsNewPageWithDimensions(widthPt, heightPt) with unit helpers
  • Landscape orientationNewPageWithSize(A4, Landscape) using swapped-MediaBox
  • Text rotationAddTextRotated with both standard 14 and custom TTF fonts
  • Angle normalization — negative and out-of-range angles normalized to [0, 360)

New Features

Page Sizes & Dimensions

// 35+ built-in sizes with IDE autocomplete
page, _ := c.NewPageWithSize(creator.A4)
page, _ := c.NewPageWithSize(creator.Slide16x9)   // 960×540 pt (PowerPoint widescreen)
page, _ := c.NewPageWithSize(creator.USTradeBook)  // 6×9 inches

// Custom dimensions with unit conversion
page, _ := c.NewPageWithDimensions(creator.InchesToPoints(8.5), creator.InchesToPoints(11))
page, _ := c.NewPageWithDimensions(creator.MMToPoints(200), creator.MMToPoints(300))

// Landscape orientation (swapped MediaBox, not /Rotate)
page, _ := c.NewPageWithSize(creator.A4, creator.Landscape)
page, _ := c.NewPageWithSize(creator.Letter, creator.Landscape)

Text Rotation

// Vertical text (90° counter-clockwise, PDF convention)
page.AddTextRotated("Sidebar", 50, 400, creator.Helvetica, 14, 90)

// With color
page.AddTextColorRotated("DRAFT", 300, 400, creator.HelveticaBold, 48, creator.Red, 45)

// Custom TTF font + rotation
page.AddTextCustomFontRotated("サイドバー", 50, 400, myFont, 14, 90)

// Negative angles normalized: -90 → 270, both produce identical output
page.AddTextRotated("Text", 100, 400, creator.Helvetica, 14, 270)  // same as -90

Unit Conversion Helpers

creator.InchesToPoints(8.5)    // 612 pt
creator.MMToPoints(210)        // ~595 pt
creator.CMToPoints(21)         // ~595 pt
creator.PointsToInches(612)    // 8.5 in
creator.PointsToMM(595)       // ~210 mm

What's Changed

  • 35+ page sizes with map-based architecture (single source of truth)
  • Orientation type with Portrait/Landscape constants
  • NewPageWithDimensions for arbitrary page sizes
  • AddTextRotated, AddTextColorRotated for standard 14 fonts
  • AddTextCustomFontRotated, AddTextCustomFontColorRotated for TTF/OTF fonts
  • Angle normalization to [0, 360) per ISO 32000 §8.3
  • Reverse unit conversions: PointsToInches, PointsToMM, PointsToCM
  • Fix: use fmt.Fprintf instead of WriteString(Sprintf) (staticcheck QF1012)

Contributors

Thanks to @ajstarks for the feature requests and API feedback that shaped this release.

Full Changelog: v0.3.0...v0.4.0

v0.3.0

16 Feb 17:11

Choose a tag to compare

GxPDF v0.3.0 "Parser Hardening"

Major parser robustness improvements, rendering fixes, and developer experience enhancements.

Highlights

  • Logging Package — slog-based configurable logging (silent by default)
  • Image RenderingDrawImage() / DrawImageFit() now produce visible images (JPEG + PNG + alpha)
  • Watermark Rendering — text watermarks with rotation and opacity
  • Error Propagation — public API no longer silently swallows errors
  • Parser Hardening — 11 community PRs fixing edge cases and a DoS vulnerability

What's New

Logging (logging/ package)

  • logging.SetLogger() / logging.Logger() API
  • Silent by default — opt-in via any slog.Handler
  • Convenience methods (ExtractText, ExtractTables, GetImages) log errors via slog

Image XObject Rendering (fixes #36)

  • DrawImage() and DrawImageFit() now work correctly in Writer
  • JPEG via /Filter /DCTDecode, PNG via /Filter /FlateDecode
  • Alpha channel support via /SMask

Watermark Rendering

  • Text watermarks with rotation, opacity, and font support
  • ExtGState for transparency

What's Fixed

Error Propagation (fixes #35)

  • ExtractTextFromPage() now returns actual errors instead of empty strings
  • All convenience methods log errors via slog instead of silently discarding them

Parser Robustness (11 PRs by @mikeschinkel)

  • Leading whitespace before %PDF- header
  • CR line endings in startxref
  • Trailing garbage after %%EOF (progressive search)
  • CMap uint16 infinite loop — DoS vulnerability fix
  • Token position after indirect Length
  • Progressive xref stream buffer (1KB → 4KB)
  • /W [0 0 0] in xref streams
  • PNG predictor support — all 5 filter types
  • Off-by-one xref object recovery with lenient parsing

Contributors

Full Changelog

See CHANGELOG.md for details.


Installation:

# CLI tool:
go install github.com/coregx/gxpdf/cmd/gxpdf@v0.3.0

# Library:
go get github.com/coregx/gxpdf@v0.3.0

# Or download binary for your platform above

Quick Start (CLI):

# Extract tables (100% accuracy!):
gxpdf tables invoice.pdf --format csv

# PDF info:
gxpdf info document.pdf

# Merge PDFs:
gxpdf merge doc1.pdf doc2.pdf -o combined.pdf

Quick Start (Library):

doc, _ := gxpdf.Open("invoice.pdf")
defer doc.Close()

tables := doc.ExtractTables()
for _, t := range tables {
    fmt.Println(t.Rows())
}

Documentation: https://github.com/coregx/gxpdf#readme

Report Issues: https://github.com/coregx/gxpdf/issues

v0.2.1

05 Feb 14:49
f1559f2

Choose a tag to compare

Hotfix: Hybrid-Reference PDF Support

Fixes parsing of MS Word-generated PDFs that use incremental updates with /Prev chain and /XRefStm hybrid cross-reference structure.

Fixed

  • /Prev Chain Support — follow trailer /Prev links to merge all cross-reference sections from incremental updates
  • /XRefStm Support — parse supplementary cross-reference streams in hybrid-reference PDFs
  • Cycle Detection — prevent infinite loops on malformed /Prev chains
  • Depth Limit — cap chain traversal at 100 levels

Details

MS Word (and other editors) save PDFs with incremental updates, producing multiple xref sections linked via /Prev. GxPDF v0.2.0 only read the last section (which may have 0 entries), causing object N not found in xref table errors.

The parser now walks the full chain, merging entries with newer-wins semantics per PDF 1.7 spec Section 7.5.6.

Closes #19

Install

go get github.com/coregx/gxpdf@v0.2.1

GxPDF v0.2.1 (2026-02-05T14:48:46Z)

Enterprise-grade PDF library for Go!

  • 100% table extraction accuracy on bank statements
  • PDF merge, split, text extraction
  • AES-256 encryption support

Changelog

🐛 Bug Fixes

  • f5f2a32: fix: support /Prev chain and /XRefStm in hybrid-reference PDFs (@kolkov)

Installation:

# CLI tool:
go install github.com/coregx/gxpdf/cmd/gxpdf@v0.2.1

# Library:
go get github.com/coregx/gxpdf@v0.2.1

# Or download binary for your platform above

Quick Start (CLI):

# Extract tables (100% accuracy!):
gxpdf tables invoice.pdf --format csv

# PDF info:
gxpdf info document.pdf

# Merge PDFs:
gxpdf merge doc1.pdf doc2.pdf -o combined.pdf

Quick Start (Library):

doc, _ := gxpdf.Open("invoice.pdf")
defer doc.Close()

tables := doc.ExtractTables()
for _, t := range tables {
    fmt.Println(t.Rows())
}

Documentation: https://github.com/coregx/gxpdf#readme

Report Issues: https://github.com/coregx/gxpdf/issues

v0.2.0

03 Feb 13:38

Choose a tag to compare

v0.2.0 "Graphics Revolution"

Major release bringing Skia-like graphics API and comprehensive Forms support.

🎨 Skia-like Graphics API

Ready for GoGPU/gg integration with professional graphics capabilities:

  • Alpha Channel Support - Full transparency via ExtGState with 12 blend modes
  • Push/Pop Graphics State - Skia-inspired state stack for transforms, opacity, blend modes
  • Fill/Stroke Separation - Independent fill (NonZero, EvenOdd) and stroke (LineCap, LineJoin, Dash)
  • Paint Interface - Unified color/gradient abstraction with RGB, RGBA, CMYK, Hex support
  • Path Builder API - Full vector paths with MoveTo, LineTo, CubicTo, QuadraticTo, shapes

📝 Forms API

Complete interactive PDF forms support:

  • Form Reading - GetFormFields(), GetFieldValue(), HasForm()
  • Form Writing - SetFieldValue() with type and option validation
  • Form Flattening - Convert interactive forms to static content
  • WASM Support - WriteTo(io.Writer) and Bytes() for browser environments

🌈 Advanced Graphics

  • Linear Gradients - Axial shading with color stops
  • Radial Gradients - Radial shading with focal point support
  • ClipPath Support - Clipping with NonZero and EvenOdd fill rules

Installation

go get github.com/coregx/gxpdf@v0.2.0

Documentation

See CHANGELOG.md for complete details.


Full Changelog: v0.1.1...v0.2.0

GxPDF v0.2.0 (2026-02-03T13:38:19Z)

Enterprise-grade PDF library for Go!

  • 100% table extraction accuracy on bank statements
  • PDF merge, split, text extraction
  • AES-256 encryption support

Changelog

🚀 Features

🐛 Bug Fixes

  • 1ec87db: fix: correct CI badge URL (test.yml not tests.yml) ( <>)
  • 262cf05: fix: pre-allocate mappings slice in tounicode.go ( <>)
  • bc83fb6: fix: pre-allocate result slice in GetFieldsToUpdate (@kolkov)

🎨 Other


Installation:

# CLI tool:
go install github.com/coregx/gxpdf/cmd/gxpdf@v0.2.0

# Library:
go get github.com/coregx/gxpdf@v0.2.0

# Or download binary for your platform above

Quick Start (CLI):

# Extract tables (100% accuracy!):
gxpdf tables invoice.pdf --format csv

# PDF info:
gxpdf info document.pdf

# Merge PDFs:
gxpdf merge doc1.pdf doc2.pdf -o combined.pdf

Quick Start (Library):

doc, _ := gxpdf.Open("invoice.pdf")
defer doc.Close()

tables := doc.ExtractTables()
for _, t := range tables {
    fmt.Println(t.Rows())
}

Documentation: https://github.com/coregx/gxpdf#readme

Report Issues: https://github.com/coregx/gxpdf/issues

v0.1.1

30 Jan 02:15

Choose a tag to compare

What's New

Features

  • Full Unicode Font Embedding - Cyrillic, CJK, and special symbols support
  • TrueType Font Subsetting - ToUnicode CMap for text extraction
  • Type 0 Composite Font - Full Unicode range support
  • Enterprise Showcase PDF - Professional 7-page brochure

Bug Fixes

  • Fixed hhea table parsing for proper glyph widths
  • Fixed PostScriptName parsing in TTF name table
  • Fixed garbled font rendering in PDF viewers

Documentation

  • Updated CHANGELOG and ROADMAP
  • Added Unicode example to README

Full Changelog: v0.1.0...v0.1.1

GxPDF v0.1.1 (2026-01-30T02:15:37Z)

Enterprise-grade PDF library for Go!

  • 100% table extraction accuracy on bank statements
  • PDF merge, split, text extraction
  • AES-256 encryption support

Changelog

🚀 Features

  • dce9617: feat: add Unicode font embedding infrastructure ( <>)
  • 951ab10: feat: enterprise showcase PDF with full Unicode support ( <>)

🐛 Bug Fixes

  • 421fd77: fix: correct PostScriptName parsing in TTF name table ( <>)
  • f19e58b: fix: correct hhea table parsing for proper glyph widths ( <>)

Installation:

# CLI tool:
go install github.com/coregx/gxpdf/cmd/gxpdf@v0.1.1

# Library:
go get github.com/coregx/gxpdf@v0.1.1

# Or download binary for your platform above

Quick Start (CLI):

# Extract tables (100% accuracy!):
gxpdf tables invoice.pdf --format csv

# PDF info:
gxpdf info document.pdf

# Merge PDFs:
gxpdf merge doc1.pdf doc2.pdf -o combined.pdf

Quick Start (Library):

doc, _ := gxpdf.Open("invoice.pdf")
defer doc.Close()

tables := doc.ExtractTables()
for _, t := range tables {
    fmt.Println(t.Rows())
}

Documentation: https://github.com/coregx/gxpdf#readme

Report Issues: https://github.com/coregx/gxpdf/issues

v0.1.0

07 Jan 02:30

Choose a tag to compare

GxPDF v0.1.0 (2026-01-07T02:27:23Z)

Enterprise-grade PDF library for Go!

  • 100% table extraction accuracy on bank statements
  • PDF merge, split, text extraction
  • AES-256 encryption support

Changelog

🚀 Features


Installation:

# CLI tool:
go install github.com/coregx/gxpdf/cmd/gxpdf@v0.1.0

# Library:
go get github.com/coregx/gxpdf@v0.1.0

# Or download binary for your platform above

Quick Start (CLI):

# Extract tables (100% accuracy!):
gxpdf tables invoice.pdf --format csv

# PDF info:
gxpdf info document.pdf

# Merge PDFs:
gxpdf merge doc1.pdf doc2.pdf -o combined.pdf

Quick Start (Library):

doc, _ := gxpdf.Open("invoice.pdf")
defer doc.Close()

tables := doc.ExtractTables()
for _, t := range tables {
    fmt.Println(t.Rows())
}

Documentation: https://github.com/coregx/gxpdf#readme

Report Issues: https://github.com/coregx/gxpdf/issues