docs: def extract_references_from_file(path,
                                   recid=None,
                                   reference_format=u"{title} {volume} ({year}) {page}",
                                   linker_callback=None,
                                   override_kbs_files=None):
      """Extract references from a local pdf file.
  
      The first parameter is the path to the file.
      It returns a list of parsed references.
      It raises FullTextNotAvailableError if the file does not exist,
      UnknownDocumentTypeError if it is not a PDF or plain text.
  
      The standard reference format is: {title} {volume} ({year}) {page}.
  
      E.g. you can change that by passing the reference_format:
  
      >>> extract_references_from_file(path, reference_format=u"{title},{volume},{page}")
  
      If you want to also link each reference to some other resource (like a record),
      you can provide a linker_callback function to be executed for every reference
      element found.
  
      To override KBs for journal names etc., use ``override_kbs_files``:
  
      >>> extract_references_from_file(path, override_kbs_files={'journals': 'my/path/to.kb'})
  
      """
      if not os.path.isfile(path):
          raise FullTextNotAvailableError(u"File not found: '{0}'".format(path))
  
      docbody = get_plaintext_document_body(path)
      reflines, dummy, dummy = extract_references_from_fulltext(docbody)
      if not reflines:
          docbody = get_plaintext_document_body(path, keep_layout=True)
          reflines, dummy, dummy = extract_references_from_fulltext(docbody)
  
      parsed_refs, stats = parse_references(
          reflines,
          recid=recid,
          reference_format=reference_format,
          linker_callback=linker_callback,
          override_kbs_files=override_kbs_files,
      )
  
      if magic.from_file(path, mime=True) == "application/pdf":
          texkeys = extract_texkeys_from_pdf(path)
          if len(texkeys) == len(parsed_refs):
              parsed_refs = [dict(ref, texkey=[key]) for ref, key in izip(parsed_refs, texkeys)]
  
      return parsed_refs