加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 使用iTextsharp编辑没有Acrofields的pdf模板

发布时间:2020-12-15 17:21:08 所属栏目:百科 来源:网络整理
导读:我有一个没有AcroFields的pdf模板,我需要替换它中的文本.文本格式如下((aFieldToReplace)),但也有一些表需要填充n个行. 是否有任何好的教程,资源或样本可供查找? Is there a way to replace a text in a PDF file with itextsharp?或多或少有相同的问题,但
我有一个没有AcroFields的pdf模板,我需要替换它中的文本.文本格式如下((aFieldToReplace)),但也有一些表需要填充n个行.

是否有任何好的教程,资源或样本可供查找?

Is there a way to replace a text in a PDF file with itextsharp?或多或少有相同的问题,但答案忽略了问题的“无Acrofield”部分.

编辑:
为了使它更难,我有多个模板,我可以使用.模板都有自己的格式样式(字体,颜色……)

编辑2:
目的是创建一个包含数据库中某些数据的报告.数据库中的数据来自ASP.NET MVC应用程序中的多种形式.
报告可能有多种布局,具体取决于所选的模板.

模板应该是动态添加的,因此我无法从头开始创建布局.我真的需要从模板中获取布局.

解决方法

引用优秀的 iText in Action:

In a PDF document,every character or glyph on a PDF page has its fixed position,regardless of the application that’s used to view the document.
[…]
Suppose you want to replace the word “edit” with the word “manipulate” in a sentence,you’d have to reflow the text. You’d have to reposition all the characters that follow that word. Maybe you’d even have to move a portion of the text to the next page. That’s not trivial,if not impossible.
[…]
Don’t expect any tool to be able to edit a PDF file the same way you’d edit a Word document.

PDF是文档显示格式.如果你想要模板,你可能不得不使用别的东西.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读