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

}

}

相关推荐
z落落1 小时前
C# 类与对象、字段、静态与非静态+四大访问修饰符
开发语言·c#
魔法阵维护师1 小时前
从零开发游戏需要学习的c#模块,第三十二章(Boss 战系统)
学习·游戏·c#
魔法阵维护师2 小时前
从零开发游戏需要学习的c#模块,第三十三章(暂停菜单)
学习·游戏·c#
z落落2 小时前
C# Stack栈 / Queue队列+所有集合 终极一页汇总(全覆盖、零遗漏)
java·开发语言·c#
淡海水3 小时前
08-认知篇-对比-injectfix深度解析
unity·c#·热更新·clr·hybrid·injectfix
周杰伦fans12 小时前
C# 踩坑 CS8370:Switch Expression 在 C# 7.3 不可用及三种解决方案
c#
z落落14 小时前
C# ToCharArray + foreach遍历 + String与StringBuilder
开发语言·c#
xiaoshuaishuai815 小时前
C# AvaloniaUI动态显示图片
开发语言·c#
csdn_aspnet18 小时前
EasyModbus 与 C# 集成
c#·modbus·easymodbus
JaydenAI20 小时前
[MAF预定义ChatClient中间件-06]利用ImageGeneratingChatClient开发专业图片生成Agent
ai·c#·agent·agent管道·chatclient中间件·chatclient管道