当前位置: 首页 > news >正文

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

http://www.lryc.cn/news/221916.html

相关文章:

  • C语言实现原码一位除
  • three.js点滴yan(整理后)
  • VMware安装CentOS最小化开发环境导引
  • 服务器端编程/数据库驱动程序/RESTful API:介绍
  • Qwt QwtThermo绘制温度计
  • U_boot介绍
  • Flink -- window(窗口)
  • 原语:串并转换器
  • 没网络也能安装.Net 3.5!如何脱机安装.NET Framework 3.5
  • JVM运行时数据区-虚拟机栈
  • Java中介者模式
  • 前端框架Vue学习 ——(五)前端工程化Vue-cli脚手架
  • App备案-iOS云管理式证书 Distribution Managed 公钥及证书SHA-1指纹的获取方法
  • Spring -Spring之依赖注入源码解析
  • Spire.Office for .NET 8.10.2 同步更新-Crk
  • MFC 基础篇(一)
  • Android技术-修改SO导出符号
  • flutter 打包apk
  • Halcon如何使用SaperaLT库连接dalsa相机
  • Vue 嵌套路由 多级路由规则
  • pandas教程:Introduction to pandas Data Structures pandas的数据结构
  • MinIO 分布式文件(对象)存储
  • HTML表单标签
  • 【黑马程序员】SpringCloud——Eureka
  • 目标跟踪(DeepSORT)
  • 2 任务2: 使用趋动云GPU进行猫狗识别实践
  • 技术分享 | app自动化测试(Android)--显式等待机制
  • 机器学习基础之《回归与聚类算法(5)—分类的评估方法》
  • 如何在macbook上删除文件?Mac删除文件的多种方法
  • Java代码Demo——Map根据key或value排序