Esempio n. 1
0
 def mExecute(self):
     targetpath = self.targetpath.text()  # 获取目标文件夹
     valueList = wordtopdf.wordtopdf(filelist,
                                     targetpath)  # 实现将Word文档批量转换为PDF
     if (valueList != -1):
         self.showLoding.clear()  # 清除进度条
         self.listpdf.addItems(valueList)  # 将转换后的PDF路径显示在目标列表中
Esempio n. 2
0
 def sExecute(self):
     targetpath = self.targetpath.text()  # 获取目标路径
     valueList = wordtopdf.wordtopdf(filelist, targetpath)  # 将多个Word文档转换为PDF文件
     if(valueList != -1):
         mergepdf.mergefiles(targetpath, 'merged.pdf', True) # 将多个PDF文件合并为一个PDF文件
         self.showLoding.clear()  # 清除进度条
         temp = [os.path.join(targetpath , 'merged.pdf')] # 组合PDF文件路径
         self.listpdf.addItems( temp)  # 将PDF文件路径显示到结果列表中
         for file in valueList: # 遍历临时生成的PDF文件列表
             os.remove(file)  # 删除PDF文件
Esempio n. 3
0
 def sExecute(self):
     targetpath = self.targetpath.text() # 获取目标路径
     valueList = wordtopdf.wordtopdf(filelist, targetpath)
     if valueList != -1:
         # 将多个PDF文件合为一个PDF文件
         mergepdf.mergefiles(targetpath, 'merged.pdf', True)
         self.showLoading.clear()
         temp = [os.path.join(targetpath, 'merged.pdf')]
         self.listpdf.addItems(temp)
         for file in valueList:
             os.remove(file)
Esempio n. 4
0
 def getList(self):
     sourcepath = self. sourcepath.text()  # 获取源路径
     if not os.path.exists(sourcepath):  # 判断是否选择了源目录
         QMessageBox.information(self,"温馨提示:","请先选择Word文档所在的文件夹!",QMessageBox.Yes)
         return
     targetpath = os.path.join(sourcepath, "pdf")  # 根据源路径生成目标目录
     if not os.path.exists(targetpath):  # 判断目录是否存在,不存在则创建
         os.makedirs(targetpath) # 创建目录
     valueList = wordtopdf.wordtopdf(filelist, targetpath)
     if(valueList != -1):
         mergepdf.mergefiles(targetpath, 'merged.pdf', True)  # 合并PDF
         temp = [os.path.join(targetpath , 'merged.pdf')] # 生成合并后的PDF文件的路径
         for file in valueList: # 遍历临时生成的PDF文件列表
             os.remove(file)  # 删除PDF文件
         isList = self.checkBox.isChecked()    # 指定是否带目录
         resultvalue=wordtopdf.getPdfOutlines(temp[0],targetpath,isList)   # 提取目录
         os.remove(temp[0]) # 删除合并后的PDF文件
         if valueList != []:
             self.listfile.clear()  # 转换完毕就将等待gif图片清理掉
         self.listfile.setText(resultvalue)  # 将生成的目录文件路径显示到页面中
Esempio n. 5
0
 def mExecute(self):
     targetpath = self.targetpath.text()
     valueList = wordtopdf.wordtopdf(filelist, targetpath)
     if valueList != -1:
         self.showLoading.clear()
         self.listpdf.addItems(valueList)