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
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

---

## [0.8.2] - 2026-05-21

### Fixed
- **Per-glyph text merging** — PDFs generated by wkhtmltopdf that emit one `Tj` operator per glyph now produce correctly merged words instead of `"D O M I C I L I O"` (#74)
- New `mergeAdjacentElements()` collapses consecutive single-glyph TextElements sharing font/size/line into word-level elements
- New `AssembleText()` replaces naive concatenation with spatial gap detection for word and line boundaries
- **Form XObject text extraction** — PDFs generated by TCPDF that place all page content inside Form XObjects (`Do` operator) now extract text correctly instead of returning empty strings (#74)
- New `processFormXObject()` with resource stack push/pop and 8-level recursion guard
- Handles nested XObjects and mixed direct/XObject content on the same page

### Added
- **Test fixtures** — Real-world CID TrueType shipping label PDFs from @iv7dev added to `testdata/pdfs/cid-fonts/` for regression testing

---

## [0.8.1] - 2026-05-21

### Fixed
Expand Down
8 changes: 8 additions & 0 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ Page sizes, custom dimensions, landscape orientation, and text rotation:

## Current Development

### v0.8.2

**Released**: May 2026

- **Per-glyph text merging** (#74) — wkhtmltopdf single-Tj-per-glyph output now merged into words via spatial gap detection
- **Form XObject extraction** (#74) — TCPDF content inside `Do` Form XObjects now extracted with resource stack and recursion guard
- Real-world CID TrueType test fixtures from @iv7dev

### v0.8.1

**Released**: May 2026
Expand Down
6 changes: 1 addition & 5 deletions document.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,7 @@ func (d *Document) ExtractTextFromPage(pageNum int) (string, error) {
return "", fmt.Errorf("failed to extract text from page %d: %w", pageNum, err)
}

var result string
for _, elem := range elements {
result += elem.Text + " "
}
return result, nil
return extractor.AssembleText(elements), nil
}

// ExtractTextElementsFromPage extracts positioned text elements from a specific page.
Expand Down
Loading
Loading