需要在现有PDF文件中附加数据 [英] Need to Append data on existing PDF file
本文介绍了需要在现有PDF文件中附加数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我想在现有的pdf文件中附加一些文字,这是我在运行时自动创建的按钮点击。
我正在使用Itextsharper。
请帮帮我。
谢谢
Anand
Hi All,
I want to append some text in existing pdf file which I have created before automatically on run time on button click.
I am using Itextsharper.
Please help me out in this.
Thanks
Anand
推荐答案
你不能......你要做的就是创建一个新的pdf并将其与旧的pdf合并。但这并不复杂。看一下Stackoverflow上的这篇文章:
http://stackoverflow.com/questions/566899/is-there-a-straight-forward-way-to-append -one-pdf-doc-to-another-using-itextshar [ ^ ]
You cant.. What you have to do is create a new pdf and merge it with the old one. But it's not complicated. Have a look at this post at Stackoverflow:
http://stackoverflow.com/questions/566899/is-there-a-straight-forward-way-to-append-one-pdf-doc-to-another-using-itextshar[^]
尝试:
Try:
Document doc = new Document( PageSize.A4, 50, 50, 50, 50 );
PdfWriter writer = PdfWriter.GetInstance( doc, new FileStream("test.pfd", FileMode.OpenOrCreate) );
doc.AddDocListener( writer );
doc.Open();
doc.Add( new Chunk("chunk", "This chunk a new text!"));
doc.Close();
参考:
使用iTextSharp将文本水印/写入现有文本PDF的 [ ^ ]
iTextSharp - 使用块,短语和段落添加文本 [ ^ ]
如何使用iTextSharp .NET PDF库在ex中插入文本和图像正在酝酿PDF格式模板 [ ^ ]
Refer:
Using iTextSharp To Watermark/Write Text To Existing PDF's[^]
iTextSharp - Adding Text with Chunks, Phrases and Paragraphs[^]
How to use iTextSharp .NET PDF library to insert text and image in an existing PDF form templa[^]
这篇关于需要在现有PDF文件中附加数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文