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

}

}

相关推荐
开开心心就好16 小时前
电子报纸离线保存:一键下载多报PDF工具
网络·笔记·macos·pdf·word·音视频·phpstorm
裴嘉靖16 小时前
Vue 生成 PDF 完整教程
前端·vue.js·pdf
张人玉17 小时前
c#串口读写威盟士五插针
开发语言·c#·通讯
睡前要喝豆奶粉17 小时前
在.NET Core Web Api中使用redis
redis·c#·.netcore
偶尔的鼠标人19 小时前
SqlSugar查询字符串转成Int的问题
c#·sqlsugar
我不是程序猿儿19 小时前
【C#】WinForms 控件句柄与 UI 刷新时机
开发语言·ui·c#
书中自有妍如玉20 小时前
Node.Js 实现模板生成Word、Word转Pdf文件、Excel生成、上传和下载
pdf·node.js·word
聪明努力的积极向上1 天前
【C#】HTTP中URL编码方式解析
开发语言·http·c#
关关长语1 天前
(四) Dotnet中MCP客户端与服务端交互通知日志信息
ai·c#·mcp
小码编匠1 天前
WPF 动态模拟CPU 使用率曲线图
后端·c#·.net