using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using iTextSharp;
using iTextSharp.text.pdf;
using System.IO;
using System.Drawing;
using iTextSharp.testutils;



public partial class pdf : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        PdfReader PDFReader = new PdfReader(Server.MapPath("c.pdf"));

        FileStream Stream = new FileStream(Server.MapPath("d.pdf"), FileMode.Create, FileAccess.Write);

        PdfStamper PDFStamper = new PdfStamper(PDFReader, Stream);

        for (int iCount = 0; iCount < PDFStamper.Reader.NumberOfPages; iCount++)
        {
            PdfContentByte PDFData = PDFStamper.GetOverContent(iCount + 1);
            BaseFont baseFont = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.EMBEDDED);
            PDFData.BeginText();
            PDFData.SetColorFill(CMYKColor.LIGHT_GRAY);
            PDFData.SetFontAndSize(baseFont, 80);
             PDFData.ShowTextAligned(PdfContentByte.ALIGN_CENTER, "Sample", 300, 400, 45);
            PDFData.EndText();
        }

      
        PDFStamper.Close();
        PDFReader.Close();
        Stream.Close();
    }


   
}

https://files.cnblogs.com/files/mqingqing123/pdf.rar

相关文章:

  • 2022-12-23
  • 2021-04-14
  • 2021-12-24
  • 2021-06-02
  • 2021-11-07
  • 2022-12-23
  • 2021-05-31
  • 2021-12-04
猜你喜欢
  • 2022-12-23
  • 2021-06-15
  • 2021-11-27
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
  • 2022-02-08
相关资源
相似解决方案