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

}

}

相关推荐
光泽雨15 小时前
动画生命周期
c#·wpf
波力海苔夹心脆67519 小时前
C# StringBuilder 详解:字符串拼接为什么总说要用它?
开发语言·笔记·c#·.net·字符串·stringbuilder·入门教程
淡海水19 小时前
06-03-源码-时间分片与调度策略
unity·c#·gc
丑梨数据20 小时前
法律合同知识库怎么搭:从图片压缩到私有化 RAG 的工程笔记
开发语言·笔记·c#
1-1=021 小时前
.NET Core 输出日志
c#·.net·.netcore
曹牧21 小时前
C#里引用ActiveX控件
开发语言·c#
宇卿.21 小时前
C#委托详解
开发语言·c#
FOAF-lambda21 小时前
Python实战:基于OpenCV与单调栈,精准定位PDF中最大的空白区域
python·opencv·pdf
努力,努力再努力1 天前
零依赖 C# Office 库到底怎么用——四个场景讲透 Wisdom.Office
c#
2501_930707781 天前
使用C#代码在 PDF 文档中创建交互操作
pdf·c#·交互