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

}

}

相关推荐
泡海椒8 小时前
Java 生成接口调用量趋势 PDF:jquick-pdf 多重折线图(JChartType.MultipleLine)落地
java·开发语言·pdf
张人玉1 天前
C#如何使用FreeSql连接数据库
数据库·c#·freesql
吴可可1232 天前
C#打断多段线实现方法
c#
Kari112 天前
医药和制造行业的外文文档批量翻译,排版怎么保住?
开发语言·c#·制造
泡海椒2 天前
quick-pdf 饼图(JChartType.PIE)实战:五个客户层级五块扇区的配色与标签
pdf
Warson_L3 天前
.NET 8 速成笔记 1:用 VS Code 做 C# / .NET 开发
c#·.net
Warson_L3 天前
.NET 8 速成笔记 9:C# 项目常见场景(基础设施篇)
c#·.net
Warson_L3 天前
.NET 8 速成笔记 8:C# 项目常见业务场景与写法(数据与业务篇)
c#·.net
Warson_L3 天前
.NET 8 速成笔记 3:作业清单
c#·.net