string url = Server.MapPath("../../WebFiles/教师职业发展报告.pdf"); PdfReader pdfReader = new PdfReader(Server.MapPath("../../WebFiles/教师职业发展报告.pdf"));//读pdf PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(Server.MapPath("../../WebFiles/FZBG/" + studyClassId + "/教师职业发展报告-" + dt.Rows[0]["Name"] + ".pdf"), FileMode.Create, FileAccess.Write, FileShare.None)); BaseFont baseFont = BaseFont.CreateFont("C:\\Windows\\Fonts\\simhei.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);//获取系统的字体 BaseFont baseFontk = BaseFont.CreateFont("C:\\Windows\\Fonts\\simkai.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); #region 第一页#endregion #region 第二页 iTextSharp.text.Font font2 = new iTextSharp.text.Font(baseFont, 11);//字体样式 Phrase ActualName2 = new Phrase(dt.Rows[0]["ActualName"].ToString(), font2);//姓名 Phrase StudentId = new Phrase(dt.Rows[0]["Name"].ToString(), font2);//学号 PdfContentByte over2 = pdfStamper.GetOverContent(2);//pdf页数 ColumnText.ShowTextAligned(over2, Element.ALIGN_CENTER, ActualName2, 265, 600, 0);//姓名 iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(Server.MapPath("../../WebFiles/Picture/" + dt.Rows[0]["Name"].ToString() + ".jpg")); img.ScaleAbsolute(72, 100); img.SetAbsolutePosition(76, 475); over2.AddImage(img); #endregion pdfStamper.Close();