Extract document text
Extracts page text, paragraph structure, word coordinates, and table cells from one document.
@lainstack/document/extract-text · Data
How to use it
Section titled “How to use it”Extract document text reads one PDF, PNG or JPEG file and returns its text and layout as several dataset handles: pages, paragraphs, textItems, words, tableCells and issues. It reads layout and runs OCR. It does not understand content, so it returns no named fields such as totals or dates.
Typical pattern: extract the text, then pick the data you need.
- Use
@lainstack/ai/promptto pull named fields out of page text. - Use
@lainstack/flow/for-each-itemto go through paragraphs or table cells. - Use
@lainstack/collection/load-arrayto read a small collection as one list.
Traps:
- The outputs are handles, not inline text. Reference a handle from a block that accepts datasets. Do not treat it as a string.
- Table cells come as one row per cell, with table, row and column numbers. Rebuild rows yourself.
- Coordinates are in points from the top-left corner of the page.
- Limits: 50 MiB, 100 pages, 240 seconds, and image files up to 16 million pixels. A larger input fails the step. No partial result is published.
- The file type is detected from the file content. A declared type that conflicts with it fails.
- OCR language is English only.
issuesis optional. It lists pages where paragraph, text item, word or table detail was not available.
Settings
Section titled “Settings”| Setting | Key | Type | Details |
|---|---|---|---|
| File (required) | file |
Value | Extract text, paragraph structure, word coordinates, and table cells from one PDF or image. |
Outputs
Section titled “Outputs”| Output | Path | Type |
|---|---|---|
| Source file | sourceRef |
Value |
| Pages | pages |
Value |
| Paragraphs | paragraphs |
Value |
| Text items | textItems |
Value |
| Words | words |
Value |
| Table cells | tableCells |
Value |
| Extraction issues | issues |
Value |
| Page count | summary.pageCount |
Number |
| Word count | summary.wordCount |
Number |
| Table count | summary.tableCount |
Number |
| Issue count | summary.issueCount |
Number |
| Extraction engine | summary.engine |
Text |
| Engine version | summary.engineVersion |
Text |
| OCR language | summary.ocrLanguage |
Text |