Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **In-Memory PDF Opening** — `OpenFromBytes()`, `OpenFromBytesWithPassword()`, and context-aware variants for server-side workflows without temp file I/O (#68)
- **Embedded Font Extraction** — `Document.GetEmbeddedFonts()` and `GetEmbeddedFontsForPage()` extract TTF/OTF font binaries from parsed PDFs for round-trip preservation (#67)
- **LoadTTFFromBytes** — `fonts.LoadTTFFromBytes()` constructor for loading fonts from extracted binary data directly into Creator API
- **Vector Graphics Extraction** — `Document.GetVectorGraphics()` and `GetVectorGraphicsForPage()` extract paths, bezier curves, colors, and opacity from parsed PDFs (#66)
- Path verb + coordinates model (MoveTo, LineTo, CubicTo, QuadTo, Close) compatible with gogpu/gg
- Graphics state stack (`q`/`Q`), CTM tracking (`cm`), CMYK→RGB conversion
- Stroke, fill, and fill-stroke paint modes with separate colors and opacity
- Line cap, line join, miter limit extraction

### Changed
- **Parser Reader Refactor** — Internal `Reader` refactored from `*os.File` to `io.ReadSeeker` interface, enabling in-memory PDF support
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,20 @@ for _, f := range fonts {
}
```

### Extracting Vector Graphics (NEW)

```go
doc, _ := gxpdf.Open("diagram.pdf")
defer doc.Close()

// Extract all vector paths with colors, opacity, and CTM-transformed coordinates
paths, _ := doc.GetVectorGraphicsForPage(1)
for _, p := range paths {
fmt.Printf("Path: %d verbs, mode=%v, stroke=%v, fill=%v\n",
len(p.Verbs), p.PaintMode, p.StrokeColor, p.FillColor)
}
```

### Extracting Tables from PDFs

```go
Expand Down
Loading
Loading