C# 通过iTextSharp实现pdf文件盖章(通过在内容中插入盖章图片的形式)

可用于审核后的pdf文件签字盖章

具体实现代码如下:

		/// <summary>
        /// 第一页盖章
        /// </summary>
        /// <param name="pdfPath">源pdf地址</param>
        /// <param name="outPdfPath">盖章后生成pdf地址</param>
        /// <param name="imagePath">盖章图片地址</param>
        public static void SignFirstPage(string pdfPath, string outPdfPath, string imagePath)
        {
   
            //创建盖章后生成pdf
            System.IO.Stream outputPdfStream = new System.IO.FileStream(outPdfPath, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.None);
            //读取原有pdf
            iTextSharp.text.pdf.PdfReader pdfReader = new iTextSharp.text.pdf.PdfReader(pdfPath);
            iTextSharp.text.pdf.PdfStamper pdfStamper = new iTextSharp.text.pdf.PdfStamper(pdfReader, outputPdfStream);
            //获取内容
            //GetUnderContent 加在内容下层
            //GetOverContent 加在内容上层
            //盖章在第一页
            iTextSharp.text.pdf.PdfContentByte pdfContentByte = pdfStamper.GetUnderContent(1);
            //获取图片
            iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值