code: def getTextBlocks(page, images=False):
      
      CheckParent(page)
      dl = page.getDisplayList()
      flags = TEXT_PRESERVE_LIGATURES | TEXT_PRESERVE_WHITESPACE
      if images:
          flags |= TEXT_PRESERVE_IMAGES
      tp = dl.getTextPage(flags)
      l = tp._extractTextBlocks_AsList()
      del tp
      del dl
      return l
docs: Return the text blocks on a page.
      
      Notes:
          Lines in a block are concatenated with line breaks.
      Args:
          images: (bool) also return meta data of any images.
          Image data are never returned with this method.
      Returns:
          A list of the blocks. Each item contains the containing rectangle coordinates,
          text lines, block type and running block number.