docs: def analyze_pages(file_name, char_margin=1.0):
      """
      Input: the file path to the PDF file
      Output: yields the layout object for each page in the PDF
      """
      log = logging.getLogger(__name__)
      # Open a PDF file.
      with open(os.path.realpath(file_name), "rb") as fp:
          # Create a PDF parser object associated with the file object.
          parser = PDFParser(fp)
          # Create a PDF document object that stores the document structure.
          # Supply the password for initialization.
          document = PDFDocument(parser, password="")
          # Create a PDF resource manager object that stores shared resources.
          rsrcmgr = PDFResourceManager()
          # Set parameters for analysis.
          laparams = LAParams(
              char_margin=char_margin, word_margin=0.1, detect_vertical=True
          )
          # Create a PDF page aggregator object.
          device = CustomPDFPageAggregator(rsrcmgr, laparams=laparams)
          # Create a PDF interpreter object.
          interpreter = PDFPageInterpreter(rsrcmgr, device)
          # Process each page contained in the document.
          for page_num, page in enumerate(PDFPage.create_pages(document)):
              try:
                  interpreter.process_page(page)
              except OverflowError as oe:
                  log.exception(
                      "{}, skipping page {} of {}".format(oe, page_num, file_name)
                  )
                  continue
              layout = device.get_result()
              yield layout