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.Cells[0].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"));

}

}

相关推荐
SEO-狼术1 小时前
Easily Add Pages to PDF Documents
pdf
她说彩礼65万5 小时前
C# lock
c#
我不是程序猿儿6 小时前
【C#】Thread.Join()、异步等待和直接join
开发语言·c#
FAREWELL000757 小时前
Unity学习总结篇(1)关于各种坐标系
学习·unity·c#·游戏引擎
编程乐趣7 小时前
一个可拖拉实现列表排序的WPF开源控件
开源·c#·.net·wpf
Risehuxyc10 小时前
备份C#的两个类
c#
csdn_aspnet10 小时前
C# WinForm treeView 全选反选 点击过快节点选中状态未选中或选中状态未取消
c#·winform
爱编程的鱼10 小时前
C#接口(Interface)全方位讲解:定义、特性、应用与实践
java·前端·c#
weixin_6289938510 小时前
批量处理+权限加密编辑转换压缩全功能提升PDF管理效率
pdf·电脑·软件构建·开源软件
Dongwoo Jeong12 小时前
UI架构的历史与基础入门
c#·mvc·mvvm·mvp·mvi·architecture