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

}

}

相关推荐
曹牧2 小时前
C#和Java的String
开发语言·c#
TextIn智能文档云平台2 小时前
如何快速提取PDF文档内容
pdf
武藤一雄2 小时前
C# Prism框架详解
开发语言·后端·微软·c#·.net·wpf
99乘法口诀万物皆可变3 小时前
CANdb++类似页面制作方案
c#
小清兔3 小时前
一个unity中URP的环境下旋转天空盒的脚本(RotationSky)
开发语言·数据库·学习·程序人生·unity·c#·游戏引擎
小马爱打代码3 小时前
Spring AI:DeepSeek 整合 RAG 增强检索: 实现与 PDF 对话
人工智能·spring·pdf
南风微微吹4 小时前
英语六级作文历年真题及范文模版汇总PDF电子版(2015-2025年6月)
pdf·英语六级
by__csdn4 小时前
第一章 (ASP.NET Core入门)第三节( 认识.NET Standard)
后端·c#·asp.net·.net·.netcore·f#·vb.net
1233211112224 小时前
Listbox DataTemplate
c#
夏霞4 小时前
c# ActiveMQ
开发语言·c#·activemq