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

}

}

相关推荐
胖纸不争3 小时前
Clasp:一个带插件系统的 .NET 10 命令行工具箱
c#·net core
曹牧12 小时前
C#:数字的定义和表示方式
算法·c#
Young_Gnay14 小时前
.NET 之 WebApi学习笔记 (持续更新)
后端·c#
李高钢14 小时前
WPF MVVM Light 入门:从零到Hello World
c#·wpf
曹牧15 小时前
C#:函数参数指定默认值
开发语言·c#
李高钢16 小时前
WPF MVVM Light(三):RelayCommand 命令与 Messenger 消息
前端·c#·wpf
qq_1508419918 小时前
从CVI(C)到Pyside(python)/Qt(C++)/VS(C#)的一点吐槽
c++·qt·c#
AI刀刀20 小时前
能生成 word 文档的文心在导出时易出现排版错乱,AI 导出鸭精准优化版式,提升文档完整性
人工智能·c#·word·excel·ai导出鸭
SpaceAIGlobal21 小时前
AI PPT生成工具哪些支持PDF文档导入?
人工智能·ai·pdf·powerpoint·办公
曹牧21 小时前
C#:字符串做20位截断
开发语言·c#