klyn.io.pdf.PDFPage.getText
method
public getText() as String
Description

Extracts Unicode text in content-stream order, with geometric line and space separation. Non-empty lines end in '\n'; pages without text return an empty String. Images are not OCRed. PDF does not prescribe a unique plain-text layout, so whitespace can differ from other PDF readers. Unmapped character codes are represented by the Unicode replacement character U+FFFD. Page/Form bounds are respected, but general vector clipping, visibility layers and text rendering modes are not rendered.

Returns

The page's extracted text.

Throws
  • PDFException on malformed/unsupported text content or after close().
Example
print(document.pages[0].getText())