1.导入iTextSharp库 首先,需要在项目中导入iTextSharp库。可以在NuGet包管理器中搜索并安装该库。 2.创建PdfReader对象 使用PdfReader类可以从PDF文件中读取内容。需要提供要读取的PDF文件的路径和起始页码。 3.创建PdfStamper对象 使用PdfStamper类可以将提取的文本写入新的PDF文件中。需要
using System.IO; using iTextSharp.text; using iTextSharp.text.pdf; public partial class Print : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { SetPDF(File.ReadAllBytes("C:\\1686850.pdf"), "C:\\1686850_1.pdf"); //test files } private void SetPDF(byte[]...