C# 或 .net 中是否有任何 API 可以编辑 pdf 文档? [英] Is there any API in C# or .net to edit pdf documents?

查看:47
本文介绍了C# 或 .net 中是否有任何 API 可以编辑 pdf 文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 C# 或 .net 中是否有任何 API 可以编辑 pdf 文档?

就像我需要检索特定文本并将其替换为我自己的文本.

Is there any API in C# or .net to edit pdf documents?

Like I need to retrieve particular text and replace it with my own text.

谢谢
nRk

推荐答案

这是不可能的(以干净和可靠的方式),来自 iTextSharp 教程:

This is not possible (in a clean & reliable way), from iTextSharp tutorial:

您无法解析"现有的 PDF 文件使用 iText,您只能阅读"它每页.这是什么意思?pdf 格式只是一个画布,其中文字和图形不放置任何结构信息.像这样中没有任何iText 对象"PDF 文件.每页都会有可能是一些字符串",但是你无法重建一个短语或一个段落使用这些字符串.[...] 你不能编辑现有的 PDF 文档,说:例如替换单词 Louagie通过洛瓦吉.为了实现这一点,你会必须知道具体位置词 Louagie,画一个白色的矩形在它上面涂上 Lowagie 这个词这个白色的矩形.请避免这种补丁"工作.做你的PDF使用 Adob​​e 产品进行编辑.

You can't 'parse' an existing PDF file using iText, you can only 'read' it page per page. What does this mean? The pdf format is just a canvas where text and graphics are placed without any structure information. As such there aren't any 'iText-objects' in a PDF file. In each page there will probably be a number of 'Strings', but you can't reconstruct a phrase or a paragraph using these strings. [...] You can't edit an existing PDF document, by saying: for instance replace the word Louagie by Lowagie. To achieve this, you would have to know the exact location of the word Louagie, paint a white rectangle over it and paint the word Lowagie on this white rectangle. Please avoid this kind of 'patch' work. Do your PDF editing with an Adobe product.

这篇关于C# 或 .net 中是否有任何 API 可以编辑 pdf 文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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