如何使用itextsharp在pdf中添加页眉和页脚 [英] How to add Header and Footer in a pdf using itextsharp
本文介绍了如何使用itextsharp在pdf中添加页眉和页脚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
我正在使用itextsharp创建一个pdf文件。我想在pdf文档中为每个页面添加页眉和页脚。谁能告诉我怎么能这样做?
我使用的是itext 5.0.4.1。在这里,我无法找到使用HeadeFooter类的选项,该类在早期版本中可用。
提前感谢。
Hello,
I am creating a pdf file using itextsharp. I want to add header and footer for each page in the pdf document. Can anyone tell me how can I do this?
I am using itext 5.0.4.1. In this, I am unable to find the option to use HeadeFooter class, which is available in the earlier versions.
Thanks in advance.
推荐答案
请参阅以下链接,其中包含视频以向您展示。
http://itextpdf.com/book/chapter.php?id=4
对于标题 - 页脚:
http://kuujinbo.info/cs/itext.aspx >
http:// www .codeproject.com / KB / graphics / ITextSharpHelperClass.aspx
如果这对您有帮助,请投票。
See the below link having video to show you.
http://itextpdf.com/book/chapter.php?id=4
For Header-Footer:
http://kuujinbo.info/cs/itext.aspx
http://www.codeproject.com/KB/graphics/ITextSharpHelperClass.aspx
Please Vote if this helps to you.
参考这个
http://www.mazsoft.com/blog/post/2008/04/30/Code-sample-for-using-iTextSharp-PDF-library。 aspx [ ^ ]
http://kuujinbo.info /cs/itext.aspx [ ^ ]
Refer this
http://www.mazsoft.com/blog/post/2008/04/30/Code-sample-for-using-iTextSharp-PDF-library.aspx[^]
http://kuujinbo.info/cs/itext.aspx[^]
Hiii
请按照下面的代码
Hiii
Follow below code
PdfTemplate footerTmpl = writer.getDirectContent().createTemplate( 0, 0, pageWidth, footerHeight );
footerTmpl.setFontAndSize( someFont, someSize );
footerTmpl.setTextMatrix( x, y );
footer.showText("blah");
这里,pdftemplate是itextcharp类。这样你就可以为你的pdf文件的每一页提供页脚。
尝试这个希望它对你有用.... !!
Here, pdftemplate is the itextcharp class.with this you can give footer to each page of your pdf file.
try this hope it will work for you....!!
这篇关于如何使用itextsharp在pdf中添加页眉和页脚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文