ASP.net C# 用Aspose.pdf实现pdf合并

编程入门 行业动态 更新时间:2024-10-27 06:34:12

ASP.<a href=https://www.elefans.com/category/jswz/34/1770819.html style=net C# 用Aspose.pdf实现pdf合并"/>

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

更多推荐

ASP.net C# 用Aspose.pdf实现pdf合并

本文发布于:2023-11-16 09:57:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1616116.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:net   ASP   pdf   Aspose

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!