[Tutorials] deepin下有没有好用PDF阅读器能翻译英文的
Tofloor
poster avatar
马昕
deepin
2022-12-20 19:23
Author

我用的是wps,看pdf不错。但是没有翻译英文的能力。大家有没有推荐?感谢!

Reply Favorite View the author
All Replies
吉吉如律令
deepin
2022-12-20 21:02
#1

可以搭配copytranslator这个软件使用

Reply View the author
177******06
deepin
2022-12-20 22:06
#2

同求此类软件,我现在用的GoldenDict 这个配合wps的PDF使用,但是有点麻烦,有没有自动整个文档翻译的?

Reply View the author
寒羽
deepin
2022-12-20 22:47
#3

你可以用网业版DeepL翻译把整个PDF翻译成中文。

https://www.deepl.com/

Reply View the author
乾豫恒益
deepin
2022-12-20 23:27
#4
寒羽

你可以用网业版DeepL翻译把整个PDF翻译成中文。

https://www.deepl.com/

这个不错,试试agree

Reply View the author
来自Ubuntu的某位用户
deepin
2022-12-21 04:41
#5

可以用Python代码实现:(自己缩进代码,这里开头打不出空格)

from translate import Translator
from pdfminer.converter import PDFPageAggregator
from pdfminer.layout import LAParams
from pdfminer.pdfparser import PDFParser, PDFDocument
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.pdfdevice import PDFDevice

file = input('请输入需要翻译的文件路径:')

#获取文档对象
#fp = open("****.pdf", "rb")

#创建一个一个与文档关联的解释器
parser = PDFParser(file)

#PDF文档的对象
doc = PDFDocument()

#连接解释器和文档对象
parser.set_document(doc)
doc.set_parser(parser)

#初始化文档,当前文档没有密码,设为空字符串
doc.initialize("")

#创建PDF资源管理器
resource = PDFResourceManager()

#参数分析器
laparam = LAParams()

#创建一个聚合器
device = PDFPageAggregator(resource, laparams=laparam)

#创建PDF页面解释器
interpreter = PDFPageInterpreter(resource, device)

#使用文档对象得到页面的集合
for page in doc.get_pages():

interpreter.process_page(page)

layout = device.get_result()

for out in layout:
if hasattr(out, "get_text"):
print(out.get_text())
text = (out.get_text())

translator = Translator(to_lang=zh_CN)
result = translator.translate(text)
print(result)

Reply View the author
zhangqf
deepin
2022-12-21 07:01
#6
来自Ubuntu的某位用户

可以用Python代码实现:(自己缩进代码,这里开头打不出空格)

from translate import Translator
from pdfminer.converter import PDFPageAggregator
from pdfminer.layout import LAParams
from pdfminer.pdfparser import PDFParser, PDFDocument
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.pdfdevice import PDFDevice

file = input('请输入需要翻译的文件路径:')

#获取文档对象
#fp = open("****.pdf", "rb")

#创建一个一个与文档关联的解释器
parser = PDFParser(file)

#PDF文档的对象
doc = PDFDocument()

#连接解释器和文档对象
parser.set_document(doc)
doc.set_parser(parser)

#初始化文档,当前文档没有密码,设为空字符串
doc.initialize("")

#创建PDF资源管理器
resource = PDFResourceManager()

#参数分析器
laparam = LAParams()

#创建一个聚合器
device = PDFPageAggregator(resource, laparams=laparam)

#创建PDF页面解释器
interpreter = PDFPageInterpreter(resource, device)

#使用文档对象得到页面的集合
for page in doc.get_pages():

interpreter.process_page(page)

layout = device.get_result()

for out in layout:
if hasattr(out, "get_text"):
print(out.get_text())
text = (out.get_text())

translator = Translator(to_lang=zh_CN)
result = translator.translate(text)
print(result)

这么简短就能全文翻译,有意思!👍

只是这两个工具包在哪里可以下载?

Reply View the author
q77190858
deepin
2022-12-21 08:08
#7

用zotero吧,一个跨平台的开源的文献管理软件,配合大佬开发的zotero-pdf-translate插件,可以实现pdf划词翻译

deepin商店就有,翻译插件参考

https://blog.csdn.net/Rong_Gong/article/details/124385746

另外你想要wps一样的护眼模式的话,推荐我写的zotero-pdf-background插件😊

https://www.zhihu.com/question/528646669

Reply View the author
来自Ubuntu的某位用户
deepin
2022-12-24 17:52
#8
zhangqf

这么简短就能全文翻译,有意思!👍

只是这两个工具包在哪里可以下载?

可以通过pip安装translator和pdfminer3k库

Reply View the author