基于C#实现PDF文件合并工具

2025-01-20 16:50

本文主要是介绍基于C#实现PDF文件合并工具,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

《基于C#实现PDF文件合并工具》这篇文章主要为大家详细介绍了如何基于C#实现一个简单的PDF文件合并工具,文中的示例代码简洁易懂,有需要的小伙伴可以跟随小编一起学习一下...

界面

基于C#实现PDF文件合并工具

主要用于发票PDF文件的合并。经常出差要报销的很有用。

代码

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using iTextSharp.text;
using iTextSharp.text.pdf;
//using PdfSharp.Pdf;
//using PdfSharp.Pdf.IO;
 
namespace PdfMergeApp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            btnOpenDir.Enabled = false;
        }
 
        private List<string> pdfList;
        private string outputPdfDir;
 
        private void bntSelectDir_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
            DialogResult dialogResult = folderBrowserDialog.ShowDialog();
 
            if (dialogResult == DialogResult.OK)
            {
                string selectedFolderPath = folderBrowserDialog.SelectedPath;
                //Console.WriteLine("选择的目录是: " + selectedFolderPath);
                txtFileDir.Text = selectedFolderPath;
 
                pdfList = Directory.GetFiles(selectedFolderPath, "*.pdf").ToList();
 
                if (pdfList != null && pdfList.Count > 0)
                {
                    pdfList = pdfList.OrderBy(t => t).ToList();
                }
 
                addPdfList();
            }
        }
 
        private void addPdfList()
        {
            this.listViewWorkLogs.Items.Clear();
            int no = 1;
            foreach (var item in pdfList)
            {
                ListViewItem lvItem = new ListViewItem();
 
                lvItem.ForeColor = Color.Blue;
                lvItem.Text = no.ToString();
                lvItem.StateImageIndex = 0;
                lvItem.Tag = no - 1;
                lvItem.SubItems.Add(item);
 
                this.listViewWorkLogs.Items.Add(lvItem);
                no++;
            }
        }China编程
 
        /// <summary>
        /// 合并多个PDF文件为一个PDF文件
        /// </summary>
        /// <param name="inputFolderPath"></param>
        /// <param name="outputFolderPath"></param>
        /// <param name="outputPdfName"></param>
        public void MergePDFs(string outputFilePath, params string[] inputFilePaths)
        {
            // 获取输入文件夹中所有的PDF文件  
            //string[] inputFiles = Directory.GetFiles(inputFolderPath, "*.pdf");
 
            // 创建输出PDF文件路径  
            //string outputPdfPath = Path.Combine(outputFolderPath, outputPdfName);
 
            // 检查新输出文件是否已存在  
            if (File.Exists(outputFilePath))
            {
                // 如果已存在,则删除旧文件并创建新文件  
                Fhttp://www.chinasem.cnile.Delete(outputFilePath);
            }
 
            // 创建输出PDF文件  
            using (FileStream stream = new FileStream(outputFilePath, FileMode.Create))
            {
                Document pdfDoc = new Document();
                PdfCopy pdf = new PdfCopy(pdfDoc, stream);
                pdfDoc.Open();
 
                foreach (string file in inputFilePaths)
                {
                    // 读取每个PDF文件并将其页面添加到输出PDF中  
                    PdfReader reader = new PdfReader(file);
                    int n = reader.NumberOfPages;
                    for (int i = 1; i <= n; i++)
                    {
                        pdf.AddPage(pdf.GetImportedPage(reader, i));
                    }
                    reader.Close();
                }
 
                if (pdfDoc != null) pdfDoc.Close();
                stream.Close();
            }
        }
 
        /// <summary>
        /// 合并多个PDF文件为一个PDF文件
        /// </summary>
        /// <param name="inputFolderPath"></param>
        /// <param name="outputFolderPath"></param>
        /// <param name="outputPdfName"></param>
        public void MergePDFs(string inputFolderPath, string outputFolderPath, string outputPdfName)
        {
            // 获取输入文件夹中所有的PDF文件  
            string[] inputFiles = Directory.GetFiles(inputFolderPath, "*.pdf");
 
            // 创建输出PDF文件路径  
            string outputPdfPath = Path.Combine(outputFolderPath, outputPdfName);
 
            outputPdfPath.CreateDirectoryByPath();
 
            // 创建输出PDF文件  
            using (FileStream stream = new FileStream(outputPdfPath, FileMode.Create))
            {
                Document pdfDoc = new Document();
                PdfCopy pdf = new PdfCopy(pdfDoc, stream);
                pdfDoc.Open();
 
                foreach (string file in inputFiles)
                {
                    // 读取每个PDF文件并将其页面添加到输出PDF中  
                    PdfReader reader = new PdfReader(file);
                    int n = reader.NumberOfPages;
                    for (int i = 1; i <= n; i++)
                    {
                        pdf.AddPage(pdf.GetImportedPage(reader, i));
                    }
                    reader.Close();
                }
 
                if (pdfDoc != null) pdfDoc.Close();
                stream.Close();
            }
 
            string newOutputPdfPath = Path.Combine(outputFolderPath, "AllPDF_Merged.pdf");
            //string newOutputPdfPath = Path.Combine(outputFolderPath, outputPdfName);
 
            // 检查新输出文件是否已存在  
            if (File.Exists(newOutputPdfPath))
            {
                // 如果已存在,则删除旧文件并创建新文件  
                File.Delete(newOutputPdfPath);
            }
 
            // 重命名输出PDF文件  
            File.Move(outputPdfPath, newOutputPdfPath);
        }
 
        /// <summary>
        /// 合并多个PDF文件为一个PDF文件
        /// </summary>
        /// <param name="inputFolderPath"></param>
        /// <param name="outputFolderPath"></param>
        /// <param name="outputPdfName"></param>
        public bool MergePDFs(string outputFolderPath, string outputPdfName)
        {
            var isOk = false;
            try
            {
                // 获取输入文件夹中所有的PDF文件  
                //string[] inputFiles = Directory.GetFiles(inputFolderPath, "*.pdf");
 
                // 创建输出PDF文件路径  
                string outputPdfPath = Path.Combine(outputFolderPath, outputPdfName);
 
                outputPdfPath.CreateDirectoryByPath();
 
                // 创建输出PDF文件  
                using (FileStream stream = new FileStream(outputPdfPath, FileMode.Create))
                {
                    Document pdfDoc = new Document();
                    PdfCopy pdf = new PdfCopy(pdfDoc, stream);
                    pdfDoc.Open();
 
                    foreach (string file in pdfList)
                    {
                        // 读取每个PDF文件并将其页面添加到输出PDF中  
                        PdfReader reader = new PdfReader(file);
                        int n = reader.NumberOfPages;
                        for (int i = 1; i <= n; i++)
                        {
                            pdf.AddPage(pdf.GetImportedPage(reader, i));
                        }
                        reader.Close();
                    }
 
                    if (pdfDoc != null) pdfDoc.Close();
                    stream.Close();
                }
 
                string newOutputPdfPath = Path.Combine(outputFolderPath, "AllPDF_Merged.pdf");
                //string newOutputPdfPath = Path.Combine(outputFolderPath, outputPdfName);
 
                // 检查新输出文件是否已存在  
                if (File.Exists(newOutputPdfPath))
                {
                    // 如果已存在,则删除旧文件并创建新文件  
                    File.Delete(newOutputPdfPath);
                }
 
                // 重命名输出PDF文件  
                File.Move(outputPdfPath, newOutputPdfPath);
                isOk = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("合并异常:" + ex.Message);
            }
            return isOk;
        }
 
        private void btnMergePDF_Click(object sender, EventArgs e)
        {
            if (pdfList != null && pdfList.Count > 0)
            {
                var outputFilePath = txtFileDir.Text + "\\MergePDF_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".pdf";
                //MergePDFs(outputFilePath, pdfList.ToArray());
 
                var outputPdfName = "MergePDF_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".pdf";
                var outputPdfNameAll = txtFileDir.Text + "\\MergePDF\\" + outputPdfName;
                outputPdfDir = txtFileDir.Text + "\\MergePDF";
                //MergePDFs(txtFileDir.Text, txtFileDir.Text+ "\\MergePDF", outputPdfName);
                var isOk = MergePDFs(outputPdfDir, outputPdfName);
                if (isOk)
                {
                    lblResult.Text = "合并完成。输出文件目录:" + outputPdfNameAll;
                    btnOpenDir.Enabled = true;
                    MessageBox.Show("合并完成");
                }                
            }
            else
            {
                MessageBox.Show("你没有要合并的PDF文件");
            }
        }
 
        private void btnOpenDir_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(outputPdfDir))
            {
                OpenDirectory(outputPdfDir);
            }
            else
            {
                MessageBox.Show("合并文件没有生成");
            }
        }
 
        static void OpenDirectory(string path)
        {
            ProcessStartInfo startInfo = new ProcessStartInfo
            {
                Arguments = path,
                FileName = "explorer.exe"
            };
 
            Process.Start(startInfo);
        }
 
        private void listViewWorkLogs_ItemCheck(object sender, ItemChecwww.chinasem.cnkEventArgs e)
        {
            var listViewItem = sender as ListViewItem;
            var index = listViewItem.Tag;
            var a = 0;
        }
 
        private int selectIndex;
        private int newIndex;
        //private string selectFileName;
 
        private void listViewWorkLogs_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listViewWorkLogs.SelectedItems.Count > 0)
            {
                var listViewItem = listViewWorkLogs.SelectedItems[0];
                selectIndex = (int)listViewItem.Tag;
                newIndex = selectIndex;
            }
        }
 
        
        private void btnMoveUp_Click(object sender, EventArgs e)
        {
            if (pdfList != null && pdfList.Count > 0)
            {
                newIndex--;
                if (newIndex >= 0 && newIndex < pdfList.Count)
                {
                    var selectFileName = pdfList[selectIndex];
                    pdfList[selectIndex] = pdfList[newIndex];
                    pdfList[newIndex] = selectFileName;
                    selectIndex = newIndex;
 
                    addPdfList();
                }
                else
                {
                    newIndex = 0;
                }
            }
        }
 
        private void btnMoveDown_Click(object sender, EventArgs e)
        {
            if (pdfList != null && pdfList.Count > 0)
            {
                newIndex++;
                if (newIndex < pdfList.Count)
                {
                    var selectFileName = pdfList[selectIndex];
                    pdfList[selectIndex] = pdfList[newIndex];
                    pdfList[newIndex] = selectFileName;
                    selectIndex = newIndex;
 
                    addPdfList();
                }
              hSFiPr  else
                {
                    newIndex = pdfList.Count - 1;
                }
            }
        }
    }
}

UI代码

 
namespace PdfMergeApp
{
    partial class Form1
    {
        /// <summary>
        /// 必需的设计器变量。
        /// </summary>
        private System.ComponentModel.IContainer components = null;
 
        /// <summary>
        /// 清理所有正在使用的资源。
        /// </summary>
        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
 
        #region Windows 窗体设计器生成的代码
 
        /// <summary>
        /// 设计器支持所需的方法 - 不要修改
        /// 使用代码编辑器修改此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            this.label1 = new System.Windows.Forms.Label();
            this.txtFileDir = new System.Windows.Forms.TextBox();
            this.button1 = new System.Windows.Forms.Button();
            this.bntSelectDir = new System.Windows.Forms.Button();
            this.btnMergePDF = new System.Windows.Forms.Button();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.listViewWorkLogs = new System.Windows.Forms.ListView();
            this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.lblResult = new System.Windows.Forms.Label();
            this.btnOpenDir = new System.Windows.Forms.Button();
            this.btnMoveUp = new System.Windows.Forms.Button();
            this.btnMoveDown = new System.Windows.Forms.Button();
            this.groupBox1.SuspendLayout();
            this.groupBox2.SuspendLayout();
            this.SuspendLayout();
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(12, 9);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(75, 15);
            this.label1.TabIndex = 0;
            this.label1.Text = "选择目录:";
            // 
            // txtFileDir
            // 
            this.txtFileDir.Location = new System.Drawing.Point(90, 6);
            this.txtFileDir.Name = "txtFileDir";
            this.txtFileDir.ReadOnly = true;
            this.txtFileDir.Size = new System.Drawing.Size(491, 25);
            this.txtFileDir.TabIndex = 1;
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(120, 141);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(8, 8);
            this.button1.TabIndex = 2;
            this.button1.Text = "button1";
            this.button1.UseVisualStyleBackColor = true;
            // 
            // bntSelectDir
            // 
            this.bntSelectDir.Location = new System.Drawing.Point(600, 6);
            this.bntSelectDir.Name = "bntSelectDir";
            this.bntSelectDir.Size = new System.Drawing.Size(118, 35);
            this.bntSelectDir.TabIndex = 3;
            this.bntSelectDir.Text = "选择目录";
            this.bntSelectDir.UseVisualStyleBackColor = true;
            this.bntSelectDir.Click += new System.EventHandler(this.bntSelectDir_Click);
            // 
            // btnMergePDF
            // 
China编程            this.btnMergePDF.Location = new System.Drawing.Point(724, 7);
            this.btnMergePDF.Name = "btnMergePDF";
            this.btnMergePDF.Size = new System.Drawing.Size(94, 32);
            this.btnMergePDF.TabIndex = 3;
            this.btnMergePDF.Text = "合并PDF";
            this.btnMergePDF.UseVisualStyleBackColor = true;
            this.btnMergePDF.Click += new System.EventHandler(this.btnMergePDF_Click);
            // 
            // groupBox1
            // 
            this.groupBox1.Controls.Add(this.listViewWorkLogs);
            this.groupBox1.Location = new System.Drawing.Point(15, 49);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(764, 589);
            this.groupBox1.TabIndex = 4;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "文件列表";
            // 
            // listViewWorkLogs
            // 
            this.listViewWorkLogs.BackColor = System.Drawing.SystemColors.InactiveCaption;
            this.listViewWorkLogs.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
            this.columnHeader1,
            this.columnHeader2});
            this.listViewWorkLogs.Dock = System.Windows.Forms.DockStyle.Fill;
            this.listViewWorkLogs.FullRowSelect = true;
            this.listViewWorkLogs.GridLines = true;
            this.listViewWorkLogs.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
            this.listViewWorkLogs.HideSelection = false;
            this.listViewWorkLogs.ImeMode = System.Windows.Forms.ImeMode.NoControl;
            this.listViewWorkLogs.LabelWrap = false;
            this.listViewWorkLogs.Location = new System.Drawing.Point(3, 21);
            this.listViewWorkLogs.MultiSelect = false;
            this.listViewWorkLogs.Name = "listViewWorkLogs";
            this.listViewWorkLogs.Size = new System.Drawing.Size(758, 565);
            this.listViewWorkLogs.TabIndex = 2;
            this.listViewWorkLogs.UseCompatibleStateImageBehavior = false;
            this.listViewWorkLogs.View = System.Windows.Forms.View.Details;
            this.listViewWorkLogs.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.listViewWorkLogs_ItemCheck);
            this.listViewWorkLogs.SelectedIndexChanged += new System.EventHandler(this.listViewWorkLogs_SelectedIndexChanged);
            // 
            // columnHeader1
            // 
            this.columnHeader1.Text = "序号";
            this.columnHeader1.Width = 50;
            // 
            // columnHeader2
            // 
            this.columnHeader2.Text = "文件名";
            this.columnHeader2.Width = 580;
            // 
            // groupBox2
            // 
            this.groupBox2.Controls.Add(this.lblResult);
            this.groupBox2.Controls.Add(this.btnOpenDir);
            this.groupBox2.Location = new System.Drawing.Point(15, 644);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(809, 68);
            this.groupBox2.TabIndex = 5;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "合并结果";
            // 
            // lblResult
            // 
            this.lblResult.AutoSize = true;
            this.lblResult.Location = new System.Drawing.Point(17, 34);
            this.lblResult.Name = "lblResult";
            this.lblResult.Size = new System.Drawing.Size(55, 15);
            this.lblResult.TabIndex = 0;
            this.lblResult.Text = "label2";
            // 
            // btnOpenDir
            // 
            this.btnOpenDir.Location = new System.Drawing.Point(709, 24);
            this.btnOpenDir.Name = "btnOpenDir";
            this.btnOpenDir.Size = new System.Drawing.Size(94, 32);
            this.btnOpenDir.TabIndex = 3;
            this.btnOpenDir.Text = "查看文件";
            this.btnOpenDir.UseVisualStyleBackColor = true;
            this.btnOpenDir.Click += new System.EventHandler(this.btnOpenDir_Click);
            // 
            // btnMoveUp
            // 
            this.btnMoveUp.Location = new System.Drawing.Point(785, 141);
            this.btnMoveUp.Name = "btnMoveUp";
            this.btnMoveUp.Size = new System.Drawing.Size(33, 42);
            this.btnMoveUp.TabIndex = 6;
            this.btnMoveUp.Text = "上移";
            this.btnMoveUp.UseVisualStyleBackColor = true;
            this.btnMoveUp.Click += new System.EventHandler(this.btnMoveUp_Click);
            // 
            // btnMoveDown
            // 
            this.btnMoveDown.Location = new System.Drawing.Point(785, 224);
            this.btnMoveDown.Name = "btnMoveDown";
            this.btnMoveDown.Size = new System.Drawing.Size(33, 42);
            this.btnMoveDown.TabIndex = 6;
            this.btnMoveDown.Text = "下移";
            this.btnMoveDown.UseVisualStyleBackColor = true;
            this.btnMoveDown.Click += new System.EventHandler(this.btnMoveDown_Click);
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(836, 724);
            this.Controls.Add(this.btnMoveDown);
            this.Controls.Add(this.btnMoveUp);
            this.Controls.Add(this.groupBox2);
            this.Controls.Add(this.groupBox1);
            this.Controls.Add(this.btnMergePDF);
            this.Controls.Add(this.bntSelectDir);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.txtFileDir);
            this.Controls.Add(this.label1);
            this.Name = "Form1";
            this.Text = "PDF文件合并";
            this.groupBox1.ResumeLayout(false);
            this.groupBox2.ResumeLayout(false);
            this.groupBox2.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();
 
        }
 
        #endregion
 
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.TextBox txtFileDir;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.Button bntSelectDir;
        private System.Windows.Forms.Button btnMergePDF;
        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.ListView listViewWorkLogs;
        private System.Windows.Forms.ColumnHeader columnHeader1;
        private System.Windows.Forms.ColumnHeader columnHeader2;
        private System.Windows.Forms.GroupBox groupBox2;
        private System.Windows.Forms.Label lblResult;
        private System.Windows.Forms.Button btnOpenDir;
        private System.Windows.Forms.Button btnMoveUp;
        private System.Windows.Forms.Button btnMoveDown;
    }
}

到此这篇关于基于C#实现PDF文件合并工具的文章就介绍到这了,更多相关C# PDF文件合并内容请搜索China编程(www.chinasem.cn)以前的文章或继续浏览下面的相关文章希望大家以后多多支持编程China编程(www.chinasem.cn)!

这篇关于基于C#实现PDF文件合并工具的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1153143

相关文章

Go语言使用Buffer实现高性能处理字节和字符

《Go语言使用Buffer实现高性能处理字节和字符》在Go中,bytes.Buffer是一个非常高效的类型,用于处理字节数据的读写操作,本文将详细介绍一下如何使用Buffer实现高性能处理字节和... 目录1. bytes.Buffer 的基本用法1.1. 创建和初始化 Buffer1.2. 使用 Writ

基于WinForm+Halcon实现图像缩放与交互功能

《基于WinForm+Halcon实现图像缩放与交互功能》本文主要讲述在WinForm中结合Halcon实现图像缩放、平移及实时显示灰度值等交互功能,包括初始化窗口的不同方式,以及通过特定事件添加相应... 目录前言初始化窗口添加图像缩放功能添加图像平移功能添加实时显示灰度值功能示例代码总结最后前言本文将

Redis延迟队列的实现示例

《Redis延迟队列的实现示例》Redis延迟队列是一种使用Redis实现的消息队列,本文主要介绍了Redis延迟队列的实现示例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习... 目录一、什么是 Redis 延迟队列二、实现原理三、Java 代码示例四、注意事项五、使用 Redi

C#实现WinForm控件焦点的获取与失去

《C#实现WinForm控件焦点的获取与失去》在一个数据输入表单中,当用户从一个文本框切换到另一个文本框时,需要准确地判断焦点的转移,以便进行数据验证、提示信息显示等操作,本文将探讨Winform控件... 目录前言获取焦点改变TabIndex属性值调用Focus方法失去焦点总结最后前言在一个数据输入表单

redis-cli命令行工具的使用小结

《redis-cli命令行工具的使用小结》redis-cli是Redis的命令行客户端,支持多种参数用于连接、操作和管理Redis数据库,本文给大家介绍redis-cli命令行工具的使用小结,感兴趣的... 目录基本连接参数基本连接方式连接远程服务器带密码连接操作与格式参数-r参数重复执行命令-i参数指定命

C++中实现调试日志输出

《C++中实现调试日志输出》在C++编程中,调试日志对于定位问题和优化代码至关重要,本文将介绍几种常用的调试日志输出方法,并教你如何在日志中添加时间戳,希望对大家有所帮助... 目录1. 使用 #ifdef _DEBUG 宏2. 加入时间戳:精确到毫秒3.Windows 和 MFC 中的调试日志方法MFC

Python实现将实体类列表数据导出到Excel文件

《Python实现将实体类列表数据导出到Excel文件》在数据处理和报告生成中,将实体类的列表数据导出到Excel文件是一项常见任务,Python提供了多种库来实现这一目标,下面就来跟随小编一起学习一... 目录一、环境准备二、定义实体类三、创建实体类列表四、将实体类列表转换为DataFrame五、导出Da

Java操作PDF文件实现签订电子合同详细教程

《Java操作PDF文件实现签订电子合同详细教程》:本文主要介绍如何在PDF中加入电子签章与电子签名的过程,包括编写Word文件、生成PDF、为PDF格式做表单、为表单赋值、生成文档以及上传到OB... 目录前言:先看效果:1.编写word文件1.2然后生成PDF格式进行保存1.3我这里是将文件保存到本地后

Python实现数据清洗的18种方法

《Python实现数据清洗的18种方法》本文主要介绍了Python实现数据清洗的18种方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学... 目录1. 去除字符串两边空格2. 转换数据类型3. 大小写转换4. 移除列表中的重复元素5. 快速统

用Java打造简易计算器的实现步骤

《用Java打造简易计算器的实现步骤》:本文主要介绍如何设计和实现一个简单的Java命令行计算器程序,该程序能够执行基本的数学运算(加、减、乘、除),文中通过代码介绍的非常详细,需要的朋友可以参考... 目录目标:一、项目概述与功能规划二、代码实现步骤三、测试与优化四、总结与收获总结目标:简单计算器,设计