以编程方式替换PDF中的文本 [英] Programmatically replace text in PDF

查看:91
本文介绍了以编程方式替换PDF中的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有PDF文件,其中的文字应替换.更具体地说,应翻译文本并用翻译后的版本替换. 重要的是,其余的PDF结构保持完整.请注意,该文本在PDF中可用,并且不需要OCr之类的技术.另外,保留字体和其他文本属性也很好.

I have PDF files with text that should be replaced. More specificly, the text should be translated and replaced with the translated version. It's important that the rest of the PDF structure stays intact. Note that the text is available in the PDFs and techniques like OCr are not needed. Also, it would be nice if font and other text attributes are kept.

您建议使用哪个库将文本提取为易于编辑的格式(例如CSV),然后重新放回新文本?

Which libraries would you recommend for extracting the text to an easy to edit format (such as CSV) and put the new text back in again?

推荐答案

假定您要用其他语言替换文本,则在大多数情况下,您将不得不选择其他字体,并且字体选择并不简单.我已经使用 Foxit 库成功地更改文本或创建PDF.

Assuming you are replacing text with a different language, you will have to choose a different font in most cases, and the font choice is non-trivial. I've used the Foxit libraries to change text or create PDFs with success.

这篇关于以编程方式替换PDF中的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆