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

}

}

相关推荐
LibraJM2 小时前
一种适合程序员的 Agent 协作方式的实践
c#·copilot·agents
旋律翼26 小时前
Qt Bridges for C# 深度技术解析
开发语言·qt·c#
吴可可1237 小时前
判断多段线方向的鞋带公式法
c#
qq_454245038 小时前
BasicMethod.Map 设计框架:8 个并行基础模块的数学根基与实现
数据结构·算法·c#
Byron Loong9 小时前
【c#】Bitmap释放之 大象与蚊子
开发语言·c#
临风细雨10 小时前
从 Bun 的 Rust 重写,看 C# 如何重建 AI 基础设施层
人工智能·rust·c#
吴可可12310 小时前
C# CAD二次开发自定义实体实现
c#
z落落11 小时前
C# WinForm 线程池与事件等待+进度条暂停恢复实战案例
开发语言·c#
酷酷的身影13 小时前
Managers/APConfigManager.cs
开发语言·ui·c#
绘梨衣54714 小时前
求助帖:pdf复杂表格解析
爬虫·python·pdf