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

}

}

相关推荐
xiaoshuaishuai85 小时前
C# Codex 脚本编写
java·服务器·数据库·c#
weixin_447443258 小时前
AI启蒙Lean4
python·c#
优化控制仿真模型11 小时前
2026年初中英语大纲词汇表1600词
经验分享·pdf
我是唐青枫11 小时前
C#.NET ValueTaskSource 深入解析:零分配异步、ManualResetValueTaskSourceCore 与使用边界
c#·.net
优化控制仿真模型11 小时前
方正小标宋简体、仿宋GB2312和楷体_GB2312办公字体安装包下载安装教程
经验分享·pdf
iCxhust11 小时前
C#程序,窗体1向窗体2的textbox控件写入字符串“hello”
开发语言·c#
王莎莎-MinerU12 小时前
MinerU 生态全景:Skills、RAG、MCP、Cursor Rules
人工智能·深度学习·计算机视觉·chatgpt·pdf·软件工程
iCxhust12 小时前
C#如何实现textbox文本多行输出 且自动换行输出
开发语言·c#
包子源14 小时前
React-PDF 与 Web 预览「像素级」对齐实践
前端·react.js·pdf
政沅同学15 小时前
C# 一种很好用的设计模式 不同对象之间进行解耦通信
设计模式·c#