ASP.net C# 用Aspose.pdf实现pdf合并

直接上代码,供参考,备忘!

using System;

using System.Collections.Generic;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Data;

using System.Data.SqlClient;

using System.Xml;

using System.IO;

using Aspose.Pdf;

public partial class gxcx_Default : System.Web.UI.Page

{

protected void dyall_Click(object sender, EventArgs e)

{

int x=0;

Document doc, doc1;

doc = new Document();

string djbh;

foreach (GridViewRow gvr in this.grid.Rows)

{

if (gvr.RowType == DataControlRowType.DataRow)

{

var cb1 = (CheckBox)gvr.FindControl("CheckBox1");

if (cb1.Checked == true)

{

djbh = gvr.Cells0.Text;

if (!getpdf(djbh))

continue;

if(x==0)

{

doc= new Document(Server.MapPath("spd.pdf"));

x++;

}

else

{

doc1 = new Document(Server.MapPath("spd.pdf"));

doc.Pages.Add(doc1.Pages);

}

}

}

}

doc.Save(Server.MapPath("spd1.pdf"));

}

}

相关推荐
蜡台4 小时前
uniapp pdf文件预览组件
pdf·uni-app·合同·pdfh5
EIP低代码平台9 小时前
EIP低代码平台-系统参数配置详解|落地三级等保+高灵活私有化部署方案
低代码·c#·权限·工作流·netcore
Am-Chestnuts9 小时前
【无标题】
pdf
王莎莎-MinerU10 小时前
MCP 解决的是工具接入,科研 Agent 还缺的是科学证据接口标准化
开发语言·网络·人工智能·深度学习·pdf·c#·php
-银雾鸢尾-10 小时前
C#中Object类内的方法
开发语言·c#
tiankong121312 小时前
如何拓展多态下的子类
设计模式·c#
协享科技12 小时前
AI 读 PDF 的 2026 选型:ChatPDF、PDF.ai、通义智文之外,更要看证据链
人工智能·pdf
geats人山人海13 小时前
c# 第九章 record
开发语言·c#
-银雾鸢尾-13 小时前
C#中的抽象类与抽象方法
开发语言·c#