標籤

bat (52) 作品 (38) python (21) shell (17) windows (11) 虛擬機 (11) php (10) CPP (6) KMS (6) 程式設計 (6) docker (5) 使用教學 (5) xoops (4) 公文 (4) Apache2 (3) Excel (3) juniper (3) 資料庫 (3) mysql (2) 免動手 (2) 資料結構 (2) 軟體廣播 (2) 電腦維修 (2) Android Studio (1) Apple IPAD管理 (1) Arduino (1) CSS (1) LAMP (1) NAS (1) Ubuntu (1) VHD (1) Windows Server (1) 原因 (1) 程式應用 (1) 程式積木 (1) 編輯器 (1) 雲端硬碟 (1)

2023年10月18日 星期三

只要點兩下,就能將放進input的一堆PDF轉成在ouput資料夾內的各自的WORD

        根據上篇只要點兩下,就能將放進input的一堆PDF轉成各自的WORD,發現產出的WORD會跟執行程式PDFTOWORD.exe混在一起。當轉換的檔案多了,恐怕要用人工去一一核對,造成不便。如果產出的產出的WORD會集中在一個output資料夾,只要移動output資料即可。
 
        According to the previous article, by simply double-clicking, you can convert a bunch of PDF files that are placed in the input folder into their respective Word documents. However, it was found that the generated Word documents are mixed with the execution program PDFTOWORD.exe. When there are multiple converted files, it might be inconvenient to manually check each one. To address this issue, if the generated Word documents are centralized in an output folder, you can simply move the output folder.

下載檔案解壓密碼:demo1234
Here is the website where you can download the program and find instructions:
Download。Extraction Password: demo1234
使用教學(Instructional videos):
 


以下是開發過程與原始碼 (Development process and code):
 
安裝pdf2docx套件(Install the pdf2docx suite)
指令(command):pip install pdf2docx
 
程式名稱(Program name):PdfToWord01.py
程式內容(Code):
#請安裝套件 pdf2docx
#指令 pip install pdf2docx
from pdf2docx import Converter
import os

#取得當前目錄
Path = os.getcwd()
#取得input路徑
InputPath = Path+'\\input\\'
#取得input資料夾下的目錄或檔案
dirs = os.listdir(InputPath)
#檢查目錄是否存在
if os.path.exists(Path+'\\output'):
    #印出output資料夾存在
    print(Path+'\\output'+' exists!')
else:
    #建立output資料夾
    os.makedirs(Path+'\\output')

if dirs != []:
    for dir in dirs:
        fileName,fileExt = dir.split('.')
        if fileExt.lower() == 'pdf':
            PdfCvWord = Converter(InputPath+dir)
            PdfCvWord.convert(Path+'\\output\\'+fileName+'.docx')
            PdfCvWord.close()
else:
    print('Input is empty!!')



沒有留言:

張貼留言

只要點兩下,傳統右鍵選單改回Win11右鍵選單

系列文章: 1. 只要點兩下,就能將Win11 右鍵選單 回復 傳統右鍵選單 2. 只要點兩下,傳統右鍵選單改回Win11右鍵選單 上一篇提到只要點兩下,就能將Win11選單回到傳統選單。但是有沒有方法能夠回到Win11選單呢?                    ...