Repository navigation
docs: showcase README of how pdfgrab works, plus Lorx CI and lint fixes - #30
Merged
Merged
Conversation
Check the CLI's stdout writes and Document.Close errors instead of dropping them, close documents in tests through a helper that fails the test on a Close error, and handle Close in the example. Remove four unused helpers (float64Bits, edgeConnects, dumpTokens, charsJoinedText), an ineffectual assignment in word grouping, and apply the staticcheck simplifications. golangci-lint v2.14.0 now reports 0 issues. Refs HAL-2755
reader.go had an empty branch whose comment described a check it never made (staticcheck SA9003). The behaviour it described already holds without it: pdfcpu decrypts documents with an empty user password, and one that needs a user password fails in ReadContext, which OpenBytes maps to ErrEncrypted. Replace the branch with a comment and add two AES-256 fixtures made with qpdf plus TestEncryptedDocuments, so the README's encryption limit is a tested claim. Refs HAL-2755
fmt, vet, build, lint (golangci-lint v2.14.0) and race tests in containers, modelled on vectorless-engine's. GitHub Actions on this account cannot start jobs (HAL-1712), so this is the gate that runs. Refs HAL-2755
Covers why the library exists, a verified quick start with real output, each stage of the pipeline (content streams, text state and metrics, encodings and ToUnicode, word grouping, viewer space, the table strategies and the 0.008 pt clipped-paren fix, the hybrid), the ICDAR 2013 field comparison, negative results, agreement with pdfplumber, measured limits and where it is used. Every number is dated and linked to its report. Figures in docs/media are corrected copies of the article and blog figures: regime labels on the oracle chart, per-document metrics on the strategy chart, unsourced numbers removed, no em dashes (HAL-2760). Refs HAL-2755
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
⛔ Files ignored due to path filters (13)
📒 Files selected for processing (24)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Reviewer's GuideThis PR substantially rewrites the README as a technically candid, figure-rich guide to pdfgrab’s implementation, API, table behavior, measurements, and limitations; it also adds Lorx container CI, fixes lint/resource/output error handling, and formalizes encrypted-PDF behavior with qpdf fixtures and tests. Sequence diagram for CLI extraction with propagated output errorssequenceDiagram
participant User
participant CLI
participant Document
participant Writer
User->>CLI: run(args, stdout, stderr)
CLI->>Document: OpenFile(path)
Document-->>CLI: Document
CLI->>Document: Page(n)
CLI->>Document: ExtractTables(settings)
CLI->>Writer: emit table or text output
Writer-->>CLI: write error or success
CLI->>Document: Close()
Document-->>CLI: close error or success
CLI-->>User: return first relevant error
State diagram for encrypted PDF handlingstateDiagram-v2
[*] --> ReadContext
ReadContext --> OwnerOnly: empty password succeeds
ReadContext --> NeedsPassword: user password required
OwnerOnly --> ParsePages
ParsePages --> OpenDocument
NeedsPassword --> ErrEncrypted
OpenDocument --> [*]
ErrEncrypted --> [*]
Flow diagram for pdfgrab table extraction strategiesflowchart TD
Input[PDF page primitives and words] --> Strategy{Table strategy}
Strategy --> Lines[lines or lines_strict: ruling edges]
Strategy --> Text[ text: word alignment edges]
Strategy --> Explicit[explicit: caller-supplied grid]
Strategy --> Auto[auto: choose ruled or text axis]
Lines --> Geometry[Edges intersections cells]
Text --> Geometry
Explicit --> Geometry
Auto --> Geometry
Geometry --> Extract[ExtractTables]
Extract --> Output[Rows and CellsBBox]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rewrites the README to show how pdfgrab works, end to end:
There are 11 figures. Several originals contradicted the reports and were corrected before use: unmeasured drift rows, pooled metrics shown as per-document, and two claims that are no longer true.
Also:
The concurrent-parse data race is noted in Limits and tracked in HAL-118.
Lorx:
bit run --allgreen locally and cloud run #1 passed. Rendered on github.com with 17 images and none broken (GitHub Actions can't start jobs, HAL-1712).Part of HAL-2755. No-Linear-Issue: HAL-2755 closes with the control plane README.
Summary by Sourcery
Document pdfgrab end to end, formalize containerized CI, and tighten error handling and encrypted-document coverage.
New Features:
Bug Fixes:
Enhancements:
CI:
Documentation:
Tests:
Chores: