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

}

}

相关推荐
大鹏说大话1 小时前
基于.NET和C#构建光伏IoT物模型方案:架构设计与实践指南
物联网·c#·.net
bugcome_com15 小时前
bugcome —— 个人独立开发 6 年商业计划书
c#
优选资源分享17 小时前
全能 PDF 工具 - Icecream PDF Candy v3.17 便携版
pdf
开开心心_Every19 小时前
CDR版本转换工具,支持多版本互转免升级软件
linux·运维·服务器·云原生·edge·pdf·serverless
bugcome_com20 小时前
C# 中的封装与访问修饰符
c#
游乐码1 天前
c#成员属性
开发语言·c#
开开心心就好1 天前
实用PDF擦除隐藏信息工具,空白处理需留意
运维·服务器·windows·pdf·迭代器模式·桥接模式·1024程序员节
Never_Satisfied1 天前
在c#中,如何删除字符串中的第x个字符
开发语言·c#
Never_Satisfied1 天前
在c#中,缩放jpg文件的尺寸
算法·c#
Never_Satisfied1 天前
在c#中,控件的事件执行耗时操作导致窗体无法及时处理绘制、鼠标点击
开发语言·c#