通过Nuget添加iTextSharp引用,具体代码如下
/// <summary>
/// 添加页码
/// </summary>
/// <param name="pdfPath">pdf文件</param>
/// <param name="outPath">输出文件位置</param>
public static void PdfAddPageNumber(string pdfPath, string outPath)
{
//读取pdf
iTextSharp.text.pdf.PdfReader reader = new iTextSharp.text.pdf.PdfReader(pdfPath);
//创建新pdf
System.IO.Stream outStream = new System.IO.FileStream(outPath, System.IO.FileMode