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

}

}

相关推荐
xiaoshuaishuai84 小时前
C# GPU算力与管理
开发语言·windows·c#
hez20106 小时前
C# 15 类型系统改进:Union Types
c#·.net·.net core
FL16238631297 小时前
基于C#winform部署软前景分割DAViD算法的onnx模型实现前景分割
开发语言·算法·c#
C#程序员一枚8 小时前
高可用(High Availability, HA)
数据库·c#
weixin_520649879 小时前
C#进阶-特性全知识点总结
开发语言·c#
fengyehongWorld10 小时前
C# 创建vba用的类库
c#
澄澈青空~10 小时前
有一个叫R2C,也有一个叫G2C
java·数据库·人工智能·c#
PGFA12 小时前
深度剖析 C# LINQ 底层执行机制:别让你的应用内存莫名其妙“爆”掉!
c#·solr·linq
2601_9498146914 小时前
如何使用C#与SQL Server数据库进行交互
数据库·c#·交互
开开心心_Every14 小时前
安卓图片压缩工具,无损缩放尺寸免费好用
人工智能·pdf·计算机外设·ocr·语音识别·团队开发·规格说明书