JPG与PDF格式转换器

 该插件可实现JPG与PDF格式的互转。

 

MainForm.Designer.cs

using System.Windows.Forms;
namespace JpgToPdfConverter
{partial class MainForm{private System.ComponentModel.IContainer components = null;protected override void Dispose(bool disposing){if (disposing && (components != null)){components.Dispose();}base.Dispose(disposing);}#region Windows Form Designer generated codeprivate void InitializeComponent(){this.btnSelectJpgFiles = new System.Windows.Forms.Button();this.lstJpgFiles = new System.Windows.Forms.ListBox();this.btnConvertJpgToPdf = new System.Windows.Forms.Button();this.lblJpgStatus = new System.Windows.Forms.Label();this.btnClearJpg = new System.Windows.Forms.Button();this.btnSelectPdfFiles = new System.Windows.Forms.Button();this.lstPdfFiles = new System.Windows.Forms.ListBox();this.btnConvertPdfToJpg = new System.Windows.Forms.Button();this.lblPdfStatus = new System.Windows.Forms.Label();this.btnClearPdf = new System.Windows.Forms.Button();this.tabControl1 = new System.Windows.Forms.TabControl();this.tabPageJpgToPdf = new System.Windows.Forms.TabPage();this.tabPagePdfToJpg = new System.Windows.Forms.TabPage();this.label1 = new System.Windows.Forms.Label();this.nudDpi = new System.Windows.Forms.NumericUpDown();this.tabControl1.SuspendLayout();this.tabPageJpgToPdf.SuspendLayout();this.tabPagePdfToJpg.SuspendLayout();((System.ComponentModel.ISupportInitialize)(this.nudDpi)).BeginInit();this.SuspendLayout();// // btnSelectJpgFiles// this.btnSelectJpgFiles.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.btnSelectJpgFiles.Location = new System.Drawing.Point(5, 5);this.btnSelectJpgFiles.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);this.btnSelectJpgFiles.Name = "btnSelectJpgFiles";this.btnSelectJpgFiles.Size = new System.Drawing.Size(111, 24);this.btnSelectJpgFiles.TabIndex = 0;this.btnSelectJpgFiles.Text = "选择JPG文件";this.btnSelectJpgFiles.UseVisualStyleBackColor = true;this.btnSelectJpgFiles.Click += new System.EventHandler(this.btnSelectJpgFiles_Click);// // lstJpgFiles// this.lstJpgFiles.FormattingEnabled = true;this.lstJpgFiles.HorizontalScrollbar = true;this.lstJpgFiles.ItemHeight = 12;this.lstJpgFiles.Location = new System.Drawing.Point(5, 34);this.lstJpgFiles.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);this.lstJpgFiles.Name = "lstJpgFiles";this.lstJpgFiles.Size = new System.Drawing.Size(388, 172);this.lstJpgFiles.TabIndex = 1;// // btnConvertJpgToPdf// this.btnConvertJpgToPdf.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.btnConvertJpgToPdf.Location = new System.Drawing.Point(5, 210);this.btnConvertJpgToPdf.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);this.btnConvertJpgToPdf.Name = "btnConvertJpgToPdf";this.btnConvertJpgToPdf.Size = new System.Drawing.Size(111, 24);this.btnConvertJpgToPdf.TabIndex = 2;this.btnConvertJpgToPdf.Text = "转换为PDF";this.btnConvertJpgToPdf.UseVisualStyleBackColor = true;this.btnConvertJpgToPdf.Click += new System.EventHandler(this.btnConvertJpgToPdf_Click);// // lblJpgStatus// this.lblJpgStatus.AutoSize = true;this.lblJpgStatus.Location = new System.Drawing.Point(122, 218);this.lblJpgStatus.Name = "lblJpgStatus";this.lblJpgStatus.Size = new System.Drawing.Size(0, 12);this.lblJpgStatus.TabIndex = 3;// // btnClearJpg// this.btnClearJpg.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.btnClearJpg.Location = new System.Drawing.Point(281, 210);this.btnClearJpg.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);this.btnClearJpg.Name = "btnClearJpg";this.btnClearJpg.Size = new System.Drawing.Size(111, 24);this.btnClearJpg.TabIndex = 4;this.btnClearJpg.Text = "清除列表";this.btnClearJpg.UseVisualStyleBackColor = true;this.btnClearJpg.Click += new System.EventHandler(this.btnClearJpg_Click);// // btnSelectPdfFiles// this.btnSelectPdfFiles.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.btnSelectPdfFiles.Location = new System.Drawing.Point(5, 5);this.btnSelectPdfFiles.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);this.btnSelectPdfFiles.Name = "btnSelectPdfFiles";this.btnSelectPdfFiles.Size = new System.Drawing.Size(111, 24);this.btnSelectPdfFiles.TabIndex = 5;this.btnSelectPdfFiles.Text = "选择PDF文件";this.btnSelectPdfFiles.UseVisualStyleBackColor = true;this.btnSelectPdfFiles.Click += new System.EventHandler(this.btnSelectPdfFiles_Click);// // lstPdfFiles// this.lstPdfFiles.FormattingEnabled = true;this.lstPdfFiles.HorizontalScrollbar = true;this.lstPdfFiles.ItemHeight = 12;this.lstPdfFiles.Location = new System.Drawing.Point(5, 34);this.lstPdfFiles.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);this.lstPdfFiles.Name = "lstPdfFiles";this.lstPdfFiles.Size = new System.Drawing.Size(388, 136);this.lstPdfFiles.TabIndex = 6;// // btnConvertPdfToJpg// this.btnConvertPdfToJpg.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.btnConvertPdfToJpg.Location = new System.Drawing.Point(5, 210);this.btnConvertPdfToJpg.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);this.btnConvertPdfToJpg.Name = "btnConvertPdfToJpg";this.btnConvertPdfToJpg.Size = new System.Drawing.Size(111, 24);this.btnConvertPdfToJpg.TabIndex = 7;this.btnConvertPdfToJpg.Text = "转换为JPG";this.btnConvertPdfToJpg.UseVisualStyleBackColor = true;this.btnConvertPdfToJpg.Click += new System.EventHandler(this.btnConvertPdfToJpg_Click);// // lblPdfStatus// this.lblPdfStatus.AutoSize = true;this.lblPdfStatus.Location = new System.Drawing.Point(122, 218);this.lblPdfStatus.Name = "lblPdfStatus";this.lblPdfStatus.Size = new System.Drawing.Size(0, 12);this.lblPdfStatus.TabIndex = 8;// // btnClearPdf// this.btnClearPdf.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.btnClearPdf.Location = new System.Drawing.Point(281, 210);this.btnClearPdf.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);this.btnClearPdf.Name = "btnClearPdf";this.btnClearPdf.Size = new System.Drawing.Size(111, 24);this.btnClearPdf.TabIndex = 9;this.btnClearPdf.Text = "清除列表";this.btnClearPdf.UseVisualStyleBackColor = true;this.btnClearPdf.Click += new System.EventHandler(this.btnClearPdf_Click);// // tabControl1// this.tabControl1.Controls.Add(this.tabPageJpgToPdf);this.tabControl1.Controls.Add(this.tabPagePdfToJpg);this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;this.tabControl1.Location = new System.Drawing.Point(0, 0);this.tabControl1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);this.tabControl1.Name = "tabControl1";this.tabControl1.SelectedIndex = 0;this.tabControl1.Size = new System.Drawing.Size(422, 277);this.tabControl1.TabIndex = 10;// // tabPageJpgToPdf// this.tabPageJpgToPdf.Controls.Add(this.btnSelectJpgFiles);this.tabPageJpgToPdf.Controls.Add(this.btnClearJpg);this.tabPageJpgToPdf.Controls.Add(this.lstJpgFiles);this.tabPageJpgToPdf.Controls.Add(this.lblJpgStatus);this.tabPageJpgToPdf.Controls.Add(this.btnConvertJpgToPdf);this.tabPageJpgToPdf.Location = new System.Drawing.Point(4, 22);this.tabPageJpgToPdf.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);this.tabPageJpgToPdf.Name = "tabPageJpgToPdf";this.tabPageJpgToPdf.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);this.tabPageJpgToPdf.Size = new System.Drawing.Size(414, 251);this.tabPageJpgToPdf.TabIndex = 0;this.tabPageJpgToPdf.Text = "JPG转PDF";this.tabPageJpgToPdf.UseVisualStyleBackColor = true;// // tabPagePdfToJpg// this.tabPagePdfToJpg.Controls.Add(this.label1);this.tabPagePdfToJpg.Controls.Add(this.nudDpi);this.tabPagePdfToJpg.Controls.Add(this.btnSelectPdfFiles);this.tabPagePdfToJpg.Controls.Add(this.lstPdfFiles);this.tabPagePdfToJpg.Controls.Add(this.btnConvertPdfToJpg);this.tabPagePdfToJpg.Controls.Add(this.btnClearPdf);this.tabPagePdfToJpg.Controls.Add(this.lblPdfStatus);this.tabPagePdfToJpg.Location = new System.Drawing.Point(4, 22);this.tabPagePdfToJpg.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);this.tabPagePdfToJpg.Name = "tabPagePdfToJpg";this.tabPagePdfToJpg.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);this.tabPagePdfToJpg.Size = new System.Drawing.Size(402, 241);this.tabPagePdfToJpg.TabIndex = 1;this.tabPagePdfToJpg.Text = "PDF转JPG";this.tabPagePdfToJpg.UseVisualStyleBackColor = true;// // label1// this.label1.AutoSize = true;this.label1.Location = new System.Drawing.Point(213, 180);this.label1.Name = "label1";this.label1.Size = new System.Drawing.Size(101, 12);this.label1.TabIndex = 11;this.label1.Text = "输出图片DPI设置:";// // nudDpi// this.nudDpi.Location = new System.Drawing.Point(318, 176);this.nudDpi.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);this.nudDpi.Maximum = new decimal(new int[] {600,0,0,0});this.nudDpi.Minimum = new decimal(new int[] {72,0,0,0});this.nudDpi.Name = "nudDpi";this.nudDpi.Size = new System.Drawing.Size(74, 21);this.nudDpi.TabIndex = 10;this.nudDpi.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;this.nudDpi.Value = new decimal(new int[] {300,0,0,0});// // MainForm// this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;this.ClientSize = new System.Drawing.Size(422, 277);this.Controls.Add(this.tabControl1);this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);this.MaximizeBox = false;this.MinimizeBox = false;this.Name = "MainForm";this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;this.Text = "JPG/PDF转换器  作者: 山水(qq443440204)";this.tabControl1.ResumeLayout(false);this.tabPageJpgToPdf.ResumeLayout(false);this.tabPageJpgToPdf.PerformLayout();this.tabPagePdfToJpg.ResumeLayout(false);this.tabPagePdfToJpg.PerformLayout();((System.ComponentModel.ISupportInitialize)(this.nudDpi)).EndInit();this.ResumeLayout(false);}#endregionprivate System.Windows.Forms.Button btnSelectJpgFiles;private System.Windows.Forms.ListBox lstJpgFiles;private System.Windows.Forms.Button btnConvertJpgToPdf;private System.Windows.Forms.Label lblJpgStatus;private System.Windows.Forms.Button btnClearJpg;private System.Windows.Forms.Button btnSelectPdfFiles;private System.Windows.Forms.ListBox lstPdfFiles;private System.Windows.Forms.Button btnConvertPdfToJpg;private System.Windows.Forms.Label lblPdfStatus;private System.Windows.Forms.Button btnClearPdf;private System.Windows.Forms.TabControl tabControl1;private System.Windows.Forms.TabPage tabPageJpgToPdf;private System.Windows.Forms.TabPage tabPagePdfToJpg;private System.Windows.Forms.NumericUpDown nudDpi;private System.Windows.Forms.Label label1;}
}

MainForm.cs

using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using PdfSharp.Drawing;
using PdfSharp.Pdf;
using static System.Net.Mime.MediaTypeNames;
using Image = System.Drawing.Image;namespace JpgToPdfConverter
{public partial class MainForm : Form{// 存储选择的文件路径private List<string> selectedJpgFiles = new List<string>();private List<string> selectedPdfFiles = new List<string>();public MainForm(){InitializeComponent();}#region JPG转PDF功能// 选择JPG文件按钮点击事件private void btnSelectJpgFiles_Click(object sender, EventArgs e){using (OpenFileDialog openFileDialog = new OpenFileDialog()){openFileDialog.Filter = "JPG文件 (*.jpg;*.jpeg)|*.jpg;*.jpeg|所有文件 (*.*)|*.*";openFileDialog.Multiselect = true;openFileDialog.Title = "选择JPG文件";if (openFileDialog.ShowDialog() == DialogResult.OK){selectedJpgFiles.AddRange(openFileDialog.FileNames);UpdateJpgFileList();}}}// 更新JPG文件列表显示private void UpdateJpgFileList(){lstJpgFiles.Items.Clear();foreach (string file in selectedJpgFiles){lstJpgFiles.Items.Add(Path.GetFileName(file));}UpdateJpgStatus($"已选择 {selectedJpgFiles.Count} 个文件");}// 更新JPG转换状态private void UpdateJpgStatus(string message){lblJpgStatus.Text = message;}// 清除JPG文件列表private void btnClearJpg_Click(object sender, EventArgs e){selectedJpgFiles.Clear();UpdateJpgFileList();}// JPG转PDF按钮点击事件private void btnConvertJpgToPdf_Click(object sender, EventArgs e){if (selectedJpgFiles.Count == 0){MessageBox.Show("请先选择JPG文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);return;}using (SaveFileDialog saveFileDialog = new SaveFileDialog()){saveFileDialog.Filter = "PDF文件 (*.pdf)|*.pdf|所有文件 (*.*)|*.*";saveFileDialog.Title = "保存PDF文件";saveFileDialog.FileName = "转换结果.pdf";if (saveFileDialog.ShowDialog() == DialogResult.OK){try{UpdateJpgStatus("正在转换...");Cursor = Cursors.WaitCursor;ConvertJpgToPdf(selectedJpgFiles, saveFileDialog.FileName);UpdateJpgStatus("转换完成!");MessageBox.Show($"PDF文件已保存至:{saveFileDialog.FileName}", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information);}catch (Exception ex){UpdateJpgStatus("转换失败!");MessageBox.Show($"转换过程中发生错误:{ex.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);}finally{Cursor = Cursors.Default;}}}}// JPG转PDF核心方法//private void ConvertJpgToPdf(List<string> jpgFiles, string pdfPath)//{//    using (PdfDocument pdf = new PdfDocument())//    {//        foreach (string jpgFile in jpgFiles)//        {//            try//            {//                // 获取图像尺寸//                using (Image image = Image.FromFile(jpgFile))//                {//                    PdfPage page = pdf.AddPage();//                    page.Width = image.Width;//                    page.Height = image.Height;//                }//                // 从文件加载图像到PDF//                PdfPage pdfPage = pdf.Pages[pdf.Pages.Count - 1];//                XGraphics gfx = XGraphics.FromPdfPage(pdfPage);//                XImage xImage = XImage.FromFile(jpgFile);//                gfx.DrawImage(xImage, 0, 0);//            }//            catch (Exception ex)//            {//                MessageBox.Show($"处理文件 {Path.GetFileName(jpgFile)} 时出错:{ex.Message}", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);//            }//        }//        pdf.Save(pdfPath);//    }//}#endregionprivate void ConvertJpgToPdf(List<string> jpgFiles, string pdfPath){using (PdfDocument pdf = new PdfDocument()){foreach (string jpgFile in jpgFiles){using (Image image = Image.FromFile(jpgFile)){PdfPage page = pdf.AddPage();// 直接按像素数设置页面尺寸(1点=1像素)page.Width = image.Width;page.Height = image.Height;XGraphics gfx = XGraphics.FromPdfPage(page);XImage xImage = XImage.FromFile(jpgFile);gfx.DrawImage(xImage, 0, 0, page.Width, page.Height);}}pdf.Save(pdfPath);}}#region PDF转JPG功能// 选择PDF文件按钮点击事件private void btnSelectPdfFiles_Click(object sender, EventArgs e){using (OpenFileDialog openFileDialog = new OpenFileDialog()){openFileDialog.Filter = "PDF文件 (*.pdf)|*.pdf|所有文件 (*.*)|*.*";openFileDialog.Multiselect = true;openFileDialog.Title = "选择PDF文件";if (openFileDialog.ShowDialog() == DialogResult.OK){selectedPdfFiles.AddRange(openFileDialog.FileNames);UpdatePdfFileList();}}}// 更新PDF文件列表显示private void UpdatePdfFileList(){lstPdfFiles.Items.Clear();foreach (string file in selectedPdfFiles){lstPdfFiles.Items.Add(Path.GetFileName(file));}UpdatePdfStatus($"已选择 {selectedPdfFiles.Count} 个文件");}// 更新PDF转换状态private void UpdatePdfStatus(string message){lblPdfStatus.Text = message;}// 清除PDF文件列表private void btnClearPdf_Click(object sender, EventArgs e){selectedPdfFiles.Clear();UpdatePdfFileList();}// PDF转JPG按钮点击事件private void btnConvertPdfToJpg_Click(object sender, EventArgs e){if (selectedPdfFiles.Count == 0){MessageBox.Show("请先选择PDF文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);return;}using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog()){folderBrowserDialog.Description = "选择保存JPG文件的文件夹";if (folderBrowserDialog.ShowDialog() == DialogResult.OK){try{UpdatePdfStatus("正在转换...");Cursor = Cursors.WaitCursor;int dpi = (int)nudDpi.Value;ConvertPdfToJpg(selectedPdfFiles, folderBrowserDialog.SelectedPath, dpi);UpdatePdfStatus("转换完成!");MessageBox.Show($"JPG文件已保存至:{folderBrowserDialog.SelectedPath}", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information);}catch (Exception ex){UpdatePdfStatus("转换失败!");MessageBox.Show($"转换过程中发生错误:{ex.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);}finally{Cursor = Cursors.Default;}}}}// PDF转JPG核心方法private void ConvertPdfToJpg(List<string> pdfFiles, string outputFolder, int dpi){foreach (string pdfFile in pdfFiles){try{string fileNameWithoutExt = Path.GetFileNameWithoutExtension(pdfFile);string fileOutputFolder = Path.Combine(outputFolder, fileNameWithoutExt);// 为每个PDF创建单独的文件夹Directory.CreateDirectory(fileOutputFolder);using (PdfiumViewer.PdfDocument document = PdfiumViewer.PdfDocument.Load(pdfFile)){int pageCount = document.PageCount;for (int i = 0; i < pageCount; i++){string outputPath = Path.Combine(fileOutputFolder, $"{fileNameWithoutExt}_第{i + 1}页.jpg");using (Bitmap image = (Bitmap)document.Render(i, dpi, dpi, false)){image.Save(outputPath, System.Drawing.Imaging.ImageFormat.Jpeg);}}}}catch (Exception ex){MessageBox.Show($"处理文件 {Path.GetFileName(pdfFile)} 时出错:{ex.Message}", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);return;}}}#endregion}
}

Program.cs

using System;
using System.Windows.Forms;namespace JpgToPdfConverter
{static class Program{[STAThread]static void Main(){Application.EnableVisualStyles();Application.SetCompatibleTextRenderingDefault(false);Application.Run(new MainForm());}}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/79698.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

LlamaIndex 第八篇 MilvusVectorStore

本指南演示了如何使用 LlamaIndex 和 Milvus 构建一个检索增强生成&#xff08;RAG&#xff09;系统。 RAG 系统将检索系统与生成模型相结合&#xff0c;根据给定的提示生成新的文本。该系统首先使用 Milvus 等向量相似性搜索引擎从语料库中检索相关文档&#xff0c;然后使用生…

浅聊一下数据库的索引优化

背景 这里的索引说的是关系数据库&#xff08;MSSQL&#xff09;中的索引。 本篇不是纯技术性的内容&#xff0c;只是聊一次性能调优的经历&#xff0c;包含到一些粗浅的实现和验证手段&#xff0c;所以&#xff0c;大神忽略即可。 额…对了&#xff0c;笔者对数据库的优化手段…

【android bluetooth 框架分析 02】【Module详解 7】【VendorSpecificEventManager 模块介绍】

1. 背景 我们在 gd_shim_module 介绍章节中&#xff0c;看到 我们将 VendorSpecificEventManager 模块加入到了 modules 中。 // system/main/shim/stack.cc modules.add<hci::VendorSpecificEventManager>();在 ModuleRegistry::Start 函数中我们对 加入的所有 module…

小刚说C语言刷题—1080质因子

1.题目描述 任意输入一正整数 N &#xff0c;求出它的所有质因子。如&#xff1a;10&#xff1d;25&#xff0c;20&#xff1d;225。 输入 输入只有一行&#xff0c;包括 11个整数 n (1≤n≤32768) 输出 输出若干行&#xff0c;按从小到大的顺序给出这个数的所有质因子&am…

C语言中的宏

1.防止头文件重复包含 1.#pragma once #pragma once 是一个编译器指令&#xff0c;用于防止头文件被重复包含。它的核心作用是通过简单语法替代传统的头文件保护宏&#xff08;#ifndef/#define/#endif&#xff09;&#xff0c;提升代码简洁性和可维护性。 作用详解 防止重复…

MapReduce 模型

‌引言‌ MapReduce 是分布式计算领域的里程碑式模型&#xff0c;由 Google 在 2004 年论文中首次提出&#xff0c;旨在简化海量数据处理的复杂性。其核心思想是通过函数式编程的 ‌Map‌ &#xff08;映射&#xff09;和 ‌Reduce‌ &#xff08;归约&#xff09;阶段&#x…

Linux文件编程——标准库函数fopen、fread、fwrite等函数

1. fopen — 打开文件 函数原型&#xff1a; FILE *fopen(const char *filename, const char *mode);参数&#xff1a; filename&#xff1a;要打开的文件名&#xff0c;可以是相对路径或绝对路径。 mode&#xff1a;文件打开模式&#xff0c;表示文件的操作方式&#xff08…

从 Git 到 GitHub - 使用 Git 进行版本控制 - Git 常用命令

希望本贴能从零开始带您一起学习如何使用 Git 进行版本控制&#xff0c;并结合远程仓库 GitHub。这会是一个循序渐进的指南&#xff0c;我们开始吧&#xff01; 学习 Git 和 GitHub 的路线图&#xff1a; 理解核心概念&#xff1a;什么是版本控制&#xff1f;Git 是什么&…

2025.05.11拼多多机考真题算法岗-第四题

📌 点击直达笔试专栏 👉《大厂笔试突围》 💻 春秋招笔试突围在线OJ 👉 笔试突围OJ 04. 记忆碎片重组 问题描述 卢小姐正在开发一款名为"记忆碎片"的游戏,玩家需要分析混乱的记忆数据,推测出形成这些记忆的原始序列。游戏中,记忆数据存储在一个特殊的数…

Android Exoplayer多路不同时长音视频混合播放

在上一篇Android Exoplayer 实现多个音视频文件混合播放以及音轨切换中我们提到一个问题&#xff0c;如果视频和音频时长不一致&#xff0c;特别是想混合多个音频和多个视频时就会出问题&#xff0c;无法播放。报错如下&#xff1a; E/ExoPlayerImplInternal(11191): Playback…

Datawhale PyPOTS时间序列5月第1次笔记

课程原地址&#xff1a; https://github.com/WenjieDu/PyPOTS&#xff08;Package地址&#xff09; https://github.com/WenjieDu/BrewPOTS/tree/datawhale/202505_datawhale&#xff08;Tutorial地址&#xff09; 2.1 PyPOTS简介 PyPOTS 是一个专为处理部分观测时间序列&a…

网安学途—流量分析 attack.pcap

attack.pacp 使用Wireshark查看并分析虚拟机windows 7桌面下的attack.pcapng数据包文件&#xff0c;通过分析数据包attack.pcapng找出黑客的IP地址&#xff0c;并将黑客的IP地址作为FLAG &#xff08;形式&#xff1a;[IP地址]&#xff09;提交&#xff1a; 过滤器筛选&#x…

【大模型】DeepResearcher:通用智能体通过强化学习探索优化

DeepResearcher&#xff1a;通过强化学习在真实环境中扩展深度研究 一、引言二、技术原理&#xff08;一&#xff09;强化学习与深度研究代理&#xff08;二&#xff09;认知行为的出现&#xff08;三&#xff09;模型架构 三、实战运行方式&#xff08;一&#xff09;环境搭建…

go语言实现IP归属地查询

效果: 实现代码main.go package mainimport ("encoding/json""fmt""io/ioutil""net/http""os" )type AreaData struct {Continent string json:"continent"Country string json:"country"ZipCode …

基于STM32、HAL库的SGTL5000XNLA3R2音频接口芯片驱动程序设计

一、简介: SGTL5000XNLA3R2 是 Cirrus Logic 推出的高性能、低功耗音频编解码器,专为便携式和电池供电设备设计。它集成了立体声 ADC、DAC、麦克风前置放大器、耳机放大器和数字信号处理功能,支持 I2S/PCM 音频接口和 I2C 控制接口,非常适合与 STM32 微控制器配合使用。 二…

window 显示驱动开发-报告图形内存(一)

计算图形内存 在 VidMm 能够向客户端报告准确的帐户之前&#xff0c;它必须首先计算图形内存的总量。 VidMm 使用以下内存类型和公式来计算图形内存&#xff1a; 系统总内存 此值是操作系统可访问的系统内存总量。 BIOS 分配的内存不会出现在此数字中。 例如&#xff0c;一台…

[FA1C4] 博客链接

Blog Link 博客已经从 CSDN 转移 高情商&#xff1a;博客是给人看的 低情商&#xff1a;CSDN 已经烂了根本不能看 链接: https://fa1c4.github.io/

python通过curl访问deepseek的API调用案例

废话少说&#xff0c;开干&#xff01; API申请和充值 下面是deepeek的API网站 https://platform.deepseek.com/ 进去先注册&#xff0c;是不是手机账号密码都不重要&#xff0c;都一样&#xff0c;完事充值打米&#xff0c;主要是打米后左侧API Keys里面创建一个API Keys&am…

【计算机视觉】OpenCV项目实战:基于face_recognition库的实时人脸识别系统深度解析

基于face_recognition库的实时人脸识别系统深度解析 1. 项目概述2. 技术原理与算法设计2.1 人脸检测模块2.2 特征编码2.3 相似度计算 3. 实战部署指南3.1 环境配置3.2 数据准备3.3 实时识别流程 4. 常见问题与解决方案4.1 dlib安装失败4.2 人脸检测性能差4.3 误识别率高 5. 关键…

第6章: SEO与交互指标

第6章: SEO与交互指标 在当今的SEO环境中&#xff0c;Google越来越重视用户交互指标&#xff0c;如页面停留时长、交互性能等。本章将深入探讨如何优化网页速度和用户交互体验&#xff0c;以提升SEO效果和用户满意度。 1. Google的新时代SEO指标 随着互联网技术的发展&#xff…