可用于审核后的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