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"));

}

}

相关推荐
SamChan908 小时前
在Web应用中集成PDF多语言翻译功能:PDFTranslator API实战指南
前端·python·ai·pdf·yapi·机器翻译
czhc11400756638 小时前
7.29:树形;
c#
cm04Z9c918 小时前
C#摸鱼实录——IoC与DI案例详解
开发语言·c#
geovindu14 小时前
CSharp:Chain of Responsibility Pattern
开发语言·后端·设计模式·c#·.net·责任链模式·行为模式
颜x小16 小时前
[C#]泛型类与泛型方法
开发语言·c++·c#
caishenzhibiao16 小时前
顺势交易矩阵主图 同花顺期货通指标
java·c语言·c#
AiMagicGaGa17 小时前
免费在线 PDF 翻译工具实测:整份文档一键翻译,格式完全保留
自然语言处理·pdf·自动翻译
TDengine (老段)17 小时前
TDengine Node.js 与 C# 连接器 — Web 服务与 .NET 集成
大数据·数据库·node.js·c#·.net·时序数据库·tdengine
河西石头18 小时前
再谈C#的抽象类和接口:从“适配器”到“毛坯房”的设计哲学
开发语言·c#·接口·依赖注入·抽象类·依赖倒挂
颜x小18 小时前
[C#]——接口与继承
开发语言·c++·c#