original_docstring: 
      Converts all Word docs in `path` to PDF, collected in a temporary folder.
  
      If `tmp_path` is provided and it is an existing folder, it must be empty.
      Otherwise the folder is created.
      
docstring: Converts all Word docs in `path` to PDF, collected in a temporary folder.
  If `tmp_path` is provided and it is an existing folder, it must be empty.
  Otherwise the folder is created.
docstring_tokens: Converts all Word docs in ` path ` to PDF collected in a temporary folder . If ` tmp_path ` is provided and it is an existing folder it must be empty . Otherwise the folder is created .
code: def word_to_pdf(path, tmp_path=None):
      """
      Converts all Word docs in `path` to PDF, collected in a temporary folder.
  
      If `tmp_path` is provided and it is an existing folder, it must be empty.
      Otherwise the folder is created.
      """
      if tmp_path is None:
          tmp_path = os.path.join(path, '.tmp')
  
      check_tmp_path(tmp_path)
  
      # Use Word itself to 'save as' each file as a PDF via the comtypes library
      word = client.CreateObject('Word.Application')
      word.Visible = False
      filenames = get_files_of_type(path, ('.doc', '.docx'))
      
      bar = progressbar.ProgressBar(max_value=len(filenames))
      for i, fn in enumerate(filenames):
          doc = word.Documents.Open(os.path.join(path, fn))
          out_fn = '{}.pdf'.format(fn.split('.')[0])
          doc.SaveAs(os.path.join(tmp_path, out_fn), FileFormat=COMTYPES_PDF_FORMAT)
          doc.close()
          bar.update(i + 1)
      word.Quit()
code_tokens: def word_to_pdf ( path , tmp_path = None ) : if tmp_path is None : tmp_path = os . path . join ( path , '.tmp' ) check_tmp_path ( tmp_path ) word = client . CreateObject ( 'Word.Application' ) word . Visible = False filenames = get_files_of_type ( path , ( '.doc' , '.docx' ) ) bar = progressbar . ProgressBar ( max_value = len ( filenames ) ) for i , fn in enumerate ( filenames ) : doc = word . Documents . Open ( os . path . join ( path , fn ) ) out_fn = '{}.pdf' . format ( fn . split ( '.' ) [ 0 ] ) doc . SaveAs ( os . path . join ( tmp_path , out_fn ) , FileFormat = COMTYPES_PDF_FORMAT ) doc . close ( ) bar . update ( i + 1 ) word . Quit ( )
short_docstring: Converts all Word docs in `path` to PDF, collected in a temporary folder.
short_docstring_tokens: Converts all Word docs in ` path ` to PDF collected in a temporary folder .
comment: """
      Converts all Word docs in `path` to PDF, collected in a temporary folder.
  
      If `tmp_path` is provided and it is an existing folder, it must be empty.
      Otherwise the folder is created.
      """$SEP$# Use Word itself to 'save as' each file as a PDF via the comtypes library