def getText(page, output = "<STR_LIT:text>"):
CheckParent(page)<EOL>dl = page.getDisplayList()<EOL>formats = ("<STR_LIT:text>", "<STR_LIT:html>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>")<EOL>images = (<NUM_LIT:0>, <NUM_LIT:1>, <NUM_LIT:1>, <NUM_LIT:0>, <NUM_LIT:1>, <NUM_LIT:1>, <NUM_LIT:1>)      <EOL>try:<EOL><INDENT>f = formats.index(output.lower())<EOL><DEDENT>except:<EOL><INDENT>f = <NUM_LIT:0><EOL><DEDENT>flags = TEXT_PRESERVE_LIGATURES | TEXT_PRESERVE_WHITESPACE<EOL>if images[f] :<EOL><INDENT>flags |= TEXT_PRESERVE_IMAGES<EOL><DEDENT>tp = dl.getTextPage(flags)     <EOL>t = tp._extractText(f)<EOL>del dl<EOL>del tp<EOL>return t<EOL>
Extract a document page's text.

    Args:
        output: (str) text, html, dict, json, rawdict, xhtml or xml.

    Returns:
        the output of TextPage methods extractText, extractHTML, extractDICT, extractJSON, extractRAWDICT, extractXHTML or etractXML respectively. Default and misspelling choice is "text".