TextApi.extract()
All text on a page, as a string; lines end with
\n. Needs the extract feature.methodTextsince 1.0.0
Signature
extract(pageIndex: number): Promise<string>
Parameters
| Parameter | Type | Description |
|---|---|---|
| pageIndex | number | Zero-based page index. |
Returns
Promise<string> Lines end with \n.
Throws
INVALID_ARGUMENT— a page index out of range.PAGE_ERROR— the page or its text could not be loaded.DOCUMENT_CLOSED— the document has been closed.FEATURE_NOT_LICENSED— the license lacksextract.
Example
TypeScript
const pages = []; for (let i = 0; i < doc.pageCount; i++) pages.push(await doc.text.extract(i));