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

}

}

相关推荐
czhc11400756638 小时前
C# 428 线程、异步
开发语言·c#
唐青枫9 小时前
C#.NET ThreadLocal 深入解析:线程独享数据、性能收益与实战边界
c#·.net
烟话615 小时前
实际内存条,虚拟内存,堆,栈
c#
jiangbqing15 小时前
职场动物进化手册(升级版).pdf 免费分享
pdf·职场动物净化·职场必读潜规则
归途醉染16 小时前
Swifter.Json
c#·json·swifter.json
伽蓝_游戏16 小时前
第一章:解构游戏资源
游戏·unity·性能优化·c#·游戏引擎·游戏程序·assetbundle
合合技术团队16 小时前
智能合同审查搭建教程:低质量PDF怎么处理?先解析清洗,再分路审阅(附GitHub项目地址)
pdf·prompt·github·textin
星辰徐哥17 小时前
Unity C#入门:Visual Studio与Unity的关联配置
unity·c#·visual studio
星辰_mya19 小时前
分布式系统里的“快递中转站”——消息队列(MQ)
c#·linq
南风微微吹19 小时前
【管综】考研199管理类综合联考历年真题及答案解析PDF电子版(2009-2026年)
考研·pdf