docs: def extract_texkeys_from_pdf(pdf_file):
      """
      Extract the texkeys from the given PDF file
  
      This is done by looking up the named destinations in the PDF
  
      @param pdf_file: path to a PDF
  
      @return: list of all texkeys found in the PDF
      """
      with open(pdf_file, 'rb') as pdf_stream:
          try:
              pdf = PdfFileReader(pdf_stream, strict=False)
              destinations = pdf.getNamedDestinations()
          except Exception:
              LOGGER.debug(u"PDF: Internal PyPDF2 error, no TeXkeys returned.")
              return []
          # not all named destinations point to references
          refs = [dest for dest in destinations.iteritems()
                  if re_reference_in_dest.match(dest[0])]
          try:
              if _destinations_in_two_columns(pdf, refs):
                  LOGGER.debug(u"PDF: Using two-column layout")
  
                  def sortfunc(dest_couple):
                      return _destination_position(pdf, dest_couple[1])
  
              else:
                  LOGGER.debug(u"PDF: Using single-column layout")
  
                  def sortfunc(dest_couple):
                      (page, _, ypos, xpos) = _destination_position(
                          pdf, dest_couple[1])
                      return (page, ypos, xpos)
  
              refs.sort(key=sortfunc)
              # extract the TeXkey from the named destination name
              return [re_reference_in_dest.match(destname).group(1)
                      for (destname, _) in refs]
          except Exception:
              LOGGER.debug(u"PDF: Impossible to determine layout, no TeXkeys returned")
              return []