Extracts the text from the selected page, using additional options.

 For example:

   pdf[1].text
   # => "This is text from slide 2.\n\nAnd even more text from slide 2."

   pdf[1].text({flags: ["-table"]})
 Returns a String.
505533
def text(options={})
      flags = options.fetch(:flags, [])
      command_parts = [@pdftotext_path, "-enc", "UTF-8", "-f", @number, "-l", @number]
      command_parts += flags if flags.length > 0
      command_parts += [Shellwords.escape(@pdf.path), "-"]
      command = command_parts.join(' ')
      Grim.logger.debug { "Running pdftotext command" }
      Grim.logger.debug { command }
      `#{command}`
    end
340869
def _parseAtPage(self, src):
        
        ctxsrc = src
        src = src[len('@page'):].lstrip()
        page, src = self._getIdent(src)
        if src[:1] == ':':
            pseudopage, src = self._getIdent(src[1:])
            page = page + '_' + pseudopage
        else:
            pseudopage = None

        #src, properties = self._parseDeclarationGroup(src.lstrip())

        # Containing @ where not found and parsed
        stylesheetElements = []
        src = src.lstrip()
        properties = []

        # XXX Extended for PDF use
        if not src.startswith('{'):
            raise self.ParseError('Ruleset opening \'{\' not found', src, ctxsrc)
        else:
            src = src[1:].lstrip()

        while src and not src.startswith('}'):
            if src.startswith('@'):
                # @media, @page, @font-face
                src, atResults = self._parseAtKeyword(src)
                if atResults is not None:
                    stylesheetElements.extend(atResults)
            else:
                src, nproperties = self._parseDeclarationGroup(src.lstrip(), braces=False)
                properties += nproperties
            src = src.lstrip()

        result = [self.cssBuilder.atPage(page, pseudopage, properties)]

        return src[1:].lstrip(), result
606690
def extract_pdftotext(self, filename, **kwargs):
        """"""
        if 'layout' in kwargs:
            args = ['pdftotext', '-layout', filename, '-']
        else:
            args = ['pdftotext', filename, '-']
        stdout, _ = self.run(args)
        return stdout
1033565
public function getText(Page $page = null)
    {
        $header   = new Header(array(), $this->document);
        $contents = new PDFObject($this->document, $header, $this->content);

        return $contents->getText($this);
    }
567026
protected function _add_page_text() {

    if ( !count($this->_page_text) )
      return;

    $this->_pdf->suspend_page("");

    for ($p = 1; $p <= $this->_page_count; $p++) {
      $this->_pdf->resume_page("pagenumber=$p");

      foreach ($this->_page_text as $pt) {
        extract($pt);

        switch ($_t) {

        case "text":
          $text = str_replace(array("{PAGE_NUM}","{PAGE_COUNT}"),
                              array($p, $this->_page_count), $text);
          $this->text($x, $y, $text, $font, $size, $color, $adjust, $angle);
          break;

        case "script":
          if (!$eval) {
            $eval = new PHP_Evaluator($this);
          }
          $eval->evaluate($code, array('PAGE_NUM' => $p, 'PAGE_COUNT' => $this->_page_count));
          break;
        }
      }

      $this->_pdf->suspend_page("");
    }

    $this->_pdf->resume_page("pagenumber=".$this->_page_number);
  }
151957
def get_selected_text(self):
        
        return to_text_string(self.textCursor().selectedText()).replace(u"\u2029",
                                                     self.get_line_separator())
970421
def _page_text(page, nowrap=False):
    
    title = page.data['title']
    title = "%s\n%s" % (title, "=" * len(title))

    desc = page.data.get('description')
    if desc:
        desc = "_%s_" % desc

    img = _text_image(page)

    pars = page.data.get('extext')

    if pars:
        # pars = pars.replace(' * ', '\n * ')
        pars = re.sub(r'[ ]+\*[ ]+', '* ', pars)

    if pars and not nowrap:
        parlist = []
        for par in pars.split("\n\n"):
            parlist.append("\n".join(textwrap.wrap(par)))

        disambiguation = page.data.get('disambiguation')
        if disambiguation:
            parlist.append(' * ' + "\n * ".join(page.data.get('links')))

        pars = "\n\n".join(parlist)

    url = '<%s>' % page.data['url']

    txt = []
    txt.append(title)
    txt.append(desc)
    txt.append(url)
    txt.append(pars)
    txt.append(img)

    return "\n\n".join([x for x in txt if x])
1293310
def get_text(self, title):
        
        r = requests.get(self.api,
                         params={'action': 'parse', 'page': title, 'format': 'json'},
                         headers=self.header)
        jsd = r.json()
        return jsd['parse']['text']['*']
447375
def pdf(self, text=TEXT):
        
        self.logger.debug("Generating the PDF report...")
        html = HTML(string=self.html())
        css_file = self.css or join(dirname(abspath(__file__)),
                                    "{}.css".format(self.theme))
        css = [css_file, CSS(string=PAGE_CSS % self.__dict__)]
        html.write_pdf("{}.pdf".format(self.filename), stylesheets=css)
1042475
function selectText (element) {
                    var range;
                    if ($window.document.selection) {
                        range = $window.document.body.createTextRange();
                        range.moveToElementText(element);
                        range.select();
                    } else if ($window.getSelection) {
                        range = $window.document.createRange();
                        range.selectNode(element);
                        $window.getSelection().addRange(range);
                    }
                }
599486
def get_pageinfo(input_file, context):
    ""
    pageno = page_number(input_file) - 1
    pageinfo = context.get_pdfinfo()[pageno]
    return pageinfo
163989
def to_text(path):
    

    try:
        # python 2
        from StringIO import StringIO
        import sys

        reload(sys)  # noqa: F821
        sys.setdefaultencoding('utf8')
    except ImportError:
        from io import StringIO

    from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
    from pdfminer.converter import TextConverter
    from pdfminer.layout import LAParams
    from pdfminer.pdfpage import PDFPage

    rsrcmgr = PDFResourceManager()
    retstr = StringIO()
    codec = 'utf-8'
    laparams = LAParams()
    laparams.all_texts = True
    device = TextConverter(rsrcmgr, retstr, codec=codec, laparams=laparams)
    with open(path, 'rb') as fp:
        interpreter = PDFPageInterpreter(rsrcmgr, device)
        password = ""
        maxpages = 0
        caching = True
        pagenos = set()
        pages = PDFPage.get_pages(
            fp,
            pagenos,
            maxpages=maxpages,
            password=password,
            caching=caching,
            check_extractable=True,
        )
        for page in pages:
            interpreter.process_page(page)
    device.close()
    str = retstr.getvalue()
    retstr.close()
    return str.encode('utf-8')
804347
private void extractTablesFromAPage(ArrayList<TextPiece> linesOfAPage,
	    ArrayList<Table> tables, ArrayList<TextPiece> wordsOfAPage, int i,
	    File pdfFile, ArrayList<ArrayList<TextPiece>> linesByPage) {
	if (linesOfAPage.size() > 30) {
	    /*
	     * Checks for table keywords
	     */
	    boolean tableKwdExist = false;
	    int prevTableEndIndex = 0;
	    for (TextPiece t : linesOfAPage) {
		String textWithoutSpace = t.getText().replace(" ", "");
		if (getMatchedTabledKeyword(textWithoutSpace) != null) {
		    tableKwdExist = true;
		    break;
		}
	    }

	    /*
	     * TODO [improve]: keywords are searched twice, no need to do the
	     * first search in the future
	     */
	    if (tableKwdExist == true) {
		for (int k = 0; k < linesOfAPage.size();) {
		    TextPiece line = linesOfAPage.get(k);
		    TextPiece prevLine = (k == 0) ? null : linesOfAPage
			    .get(k - 1);
		    String textWithoutSpace = line.getText().replace(" ", "");
		    String keyword = getMatchedTabledKeyword(textWithoutSpace);

		    if (keyword != null
			    && (textWithoutSpace.startsWith("tableofcontent") == false)
			    && (textWithoutSpace.startsWith("TABLEOFCONTENT") == false)
			    && (textWithoutSpace.startsWith("TableofContent") == false)) {
			char lastCharInKwd = keyword
				.charAt(keyword.length() - 1);
			String oldKwd = line.getText().substring(0,
				line.getText().indexOf(lastCharInKwd) + 1);
			String newLine = "Table"
				+ line.getText()
					.substring(
						line.getText().indexOf(
							lastCharInKwd) + 1,
						line.getText().length());
			// linesOfAPage.get(k).setText(newLine);

			if (prevLine != null && line.getY() == prevLine.getY())
			    k++;
			else {
			    /*
			     * try to extract this table
			     */
			    TableCandidate tc = new TableCandidate();
			    tc.setKeyword(keyword);
			    // tc.setXMLDoc(xml_doc); // to add all table
			    // metadata elements in TableCandidate

			    k = extractOneTable(k, linesOfAPage, keyword, tc,
				    wordsOfAPage, i, prevTableEndIndex,
				    linesByPage);
			    if (tc.isValid()) {
				if (tc.isTopCaption())
				    prevTableEndIndex = tc.getBodyEndLine();
				else
				    prevTableEndIndex = tc.getCaptionEndLine();
				if (Config.DEBUG_MODE)
				    tc.print();
				String metadata_StructureLevel = tc
					.getMetadata_StructureLevel();
				String tableMeta_thisDoc = m_docInfo
					.getTableMetaInThisDoc();
				String tableMetaHighLevel = tc
					.getMetadata_HighLevel();
				String latestMetaData = tableMeta_thisDoc
					+ tableMetaHighLevel
					+ metadata_StructureLevel;
				m_docInfo.setTableMetadata(latestMetaData);

				/*
				 * Generates the extracted table list, then XML
				 * output from each table
				 */
				// System.out.println(Integer.toString(i)+" Adding");
				Table oneTable = new Table();
				oneTable.setValidTable(tc);
				tables.add(oneTable);

				oneTable.setPageNumber(i + 1);
			    }
			}
		    } else
			k++;
		}
	    } else {// TODO: log
	    }
	} else {
	    /*
	     * Impossible to contain tables because of few texts in the page
	     */
	}
    }
548892
function selectedText(editor) {
    restoreRange(editor);
    if (ie) return getRange(editor).text;
    return getSelection(editor).toString();
  }
620364
def text(self):
        """"""
        if isinstance(self.source, str):
            return self.source
        else:
            return self.source()
1051369
function splitPagesPromise (content) {
    var pages = content.split(/\f/)
    if (!pages) {
      var ex = {
        message: 'pdf-text-extract failed',
        error: 'no text returned from the pdftotext command',
        filePath: this.filePath,
        stack: new Error().stack
      }
      throw ex
    }
    // sometimes there can be an extract blank page on the end
    var lastPage = pages[pages.length - 1]
    if (!lastPage) {
      pages.pop()
    }
    resolve(pages)
  }
943707
def select_text(self, coordinate, text, select2drop=None):
        '''
        
        '''
        if not isinstance(coordinate, Select):
            if isinstance(coordinate, str):
                element = self.get_element(coordinate)
            else:
                element = coordinate
            if element.tag_name.lower() != "select":
                # Selenium's Select does not support non-select tags
                return self.select2(element, select2drop, text)
            selection = Select(element)
        else:
            selection = coordinate
            # TODO: Can't understand why Select made it private, replace Select in the future(?)
            element = coordinate._el
        if isinstance(text, int):
            if select2drop is not None:
                return self.select2(element, select2drop, text)
            return selection.select_by_index(text)
        try:
            selection.select_by_visible_text(text)
            return True
        except NoSuchElementException:
            available_selections = []
            for option in selection.options:
                if text in option.text:
                    selection.select_by_visible_text(option.text)
                    return True
                available_selections.append(option.text)
            print("[Error!] Selection not found: {}".format(text))
            print("Available Selections\n {}".format(available_selections))
        except ValueError:
            if select2drop is None:
                print("[Hint] You might be dealing with a select2 element. Try specifying select2drop locator.")
                raise
            # We are assuming we encountered a select2 selection box
            self.select2(element, select2drop, text)