JPG与PDF格式转换器

news2025/7/19 18:26:21

 该插件可实现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 code

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

        }

        #endregion

        private 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);
        //    }
        //}
        #endregion
        private 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.coloradmin.cn/o/2375224.html

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

相关文章

手搓传染病模型(SEIARW)

在传染病传播的研究中&#xff0c;水传播途径是一个重要的考量因素。SEAIRW 模型&#xff08;易感者 S - 暴露者 E - 感染者 I - 无症状感染者 A - 康复者 R - 水中病原体 W&#xff09;综合考虑了人与人接触传播以及水传播的双重机制&#xff0c;为分析此类传染病提供了全面的…

【Mac 从 0 到 1 保姆级配置教程 15】- Python 环境一键安装与配置,就是这么的丝滑

文章目录 前言安装 Python 环境VSCode 配置Python 环境NeoVim 配置 Python 环境&#xff08;选看&#xff09;1. Python LSP 配置2. 打开 python 语言支持 最后参考资料系列教程 Mac 从 0 到 1 保姆级配置教程目录&#xff0c;点击即可跳转对应文章&#xff1a; 【Mac 从 0 到 …

【递归、搜索与回溯】专题一:递归(二)

&#x1f4dd;前言说明&#xff1a; 本专栏主要记录本人递归&#xff0c;搜索与回溯算法的学习以及LeetCode刷题记录&#xff0c;按专题划分每题主要记录&#xff1a;&#xff08;1&#xff09;本人解法 本人屎山代码&#xff1b;&#xff08;2&#xff09;优质解法 优质代码…

Spark缓存-cache

一、RDD持久化 1.什么时候该使用持久化&#xff08;缓存&#xff09; 2. RDD cache & persist 缓存 3. RDD CheckPoint 检查点 4. cache & persist & checkpoint 的特点和区别 特点 区别 二、cache & persist 的持久化级别及策略选择 Spark的几种持久化…

记录算法笔记(2025.5.13)二叉树的最大深度

给定一个二叉树 root &#xff0c;返回其最大深度。 二叉树的 最大深度 是指从根节点到最远叶子节点的最长路径上的节点数。 示例 1&#xff1a; 输入&#xff1a;root [3,9,20,null,null,15,7] 输出&#xff1a;3 示例 2&#xff1a; 输入&#xff1a;root [1,null,2] …

【Linux】简单设计libc库

&#x1f4dd;前言&#xff1a; 经过之间两篇文章&#xff0c;【Linux】基础IO&#xff08;一&#xff09;和【Linux】基础IO&#xff08;二&#xff09;的学些&#xff0c;我们对文件的基础IO已经有了一定的理解。 这篇文章我们来简单设计一下libc库&#xff0c;来复习一下文…

milvus+flask山寨《从零构建向量数据库》第7章case2

继续流水账完这本书&#xff0c;这个案例是打造文字形式的个人知识库雏形。 create_context_db: # Milvus Setup Arguments COLLECTION_NAME text_content_search DIMENSION 2048 MILVUS_HOST "localhost" MILVUS_PORT "19530"# Inference Arguments…

【Canda】常用命令+虚拟环境创建到选择

目录 一、conda常用命令 二、conda 环境 2.1 创建虚拟环境 2.2 conda环境切换 2.3 查看conda环境 2.4 删除某个conda环境 2.5 克隆环境 三、依赖包管理 3.1 安装命令 3.2 更新包 3.3 卸载包 3.4 查看环境中所有包 3.5 查看某个包的版本信息 3.6 搜索包 四、环境…

【登录认证】JWT令牌

一、概述 JWT全称:**JSON Web Token **(https://jwt.io/)定义了一种简洁的、自包含的格式&#xff0c;用于通信双方以json数据格式安全的传输信息。组成: ①第一部分:Header(头)&#xff0c;记录令牌类型、签名算法等。例如: (“alg”:" HS256"," type":“…

python3:文件与异常

本来这篇教程是打算在base python数据类型之后出的&#xff0c;但是计划赶不上变化&#xff0c;反正最后都要融会贯通&#xff0c;今日有时间、今天遇到了类似的问题&#xff0c;就今天做这一模块的整理&#xff0c;顺序不是重点。 参考我的上一篇博客&#xff1a;https://blo…

【兽医电子处方软件】佳易王宠物医院电子处方管理系统:宠物医院诊所用什么软件?一键导入配方模板软件程序实操教程 #操作简单 #宠物医院软件下载安装

一、概述 软件试用版资源文件下载方法&#xff1a; 【进入头像主页第一篇文章最后 卡片按钮 可点击了解详细资料 或左上角本博客主页 右侧按钮了解具体资料信息】 本实例以 佳易王宠物医院电子处方管理系统软件 为例说明&#xff0c;其他版本可参考本实例。试用版软…

问题及解决02-处理后的图像在坐标轴外显示

一、问题 在使用matlab的appdesigner工具来设计界面&#xff0c;可以通过点击处理按钮来处理图像&#xff0c;并将处理后的图像显示在坐标轴上&#xff0c;但是图像超出了指定的坐标轴&#xff0c;即处理后的图像在坐标轴外显示。 问题图如下图所示。 原来的坐标轴如下图所…

EasyX开发——绘制跟随鼠标移动的小球

游戏主循环&#xff1a; #include<graphics.h>int main() {initgraph(1280, 720);while (true){}return 0; } peekmessage函数&#xff1a;如果成功拉取到了消息&#xff0c;函数就会返回true&#xff0c;反之就会返回false 使用另外一个循环来不断地从消息队列当中拉取…

【Qt开发】信号与槽

目录 1&#xff0c;信号与槽的介绍 2&#xff0c;信号与槽的运用 3&#xff0c;自定义信号 1&#xff0c;信号与槽的介绍 在Qt框架中&#xff0c;信号与槽机制是一种用于对象间通信的强大工具。它是在Qt中实现事件处理和回调函数的主要方法。 信号&#xff1a;窗口中&#x…

使用聊天模型和提示模板构建一个简单的 LLM 应用程序

官方教程 官方案例 在上面的链接注册后&#xff0c;请确保设置您的环境变量以开始记录追踪 export LANGSMITH_TRACING"true" export LANGSMITH_API_KEY"..."或者&#xff0c;如果在笔记本中&#xff0c;您可以使用以下命令设置它们 import getpass imp…

探索 C++23 的 views::cartesian_product

文章目录 一、背景与动机二、基本概念与语法三、使用示例四、特点与优势五、性能与优化六、与 P2374R4 的关系七、编译器支持八、总结 C23 为我们带来了一系列令人兴奋的新特性&#xff0c;其中 views::cartesian_product 是一个非常实用且强大的功能&#xff0c;它允许我们轻…

【docker】--镜像管理

文章目录 拉取镜像启动镜像为容器连接容器法一法二 保存镜像加载镜像镜像打标签移除镜像 拉取镜像 docker pull mysql:8.0.42启动镜像为容器 docker run -dp 8080:8080 --name container_mysql8.0.42 -e MYSQL_ROOT_PASSWORD123123123 mysql:8.0.42 连接容器 法一 docker e…

Ensemble Alignment Subspace Adaptation Method for Cross-Scene Classification

用于跨场景分类的集成对齐子空间自适应方法 摘要&#xff1a;本文提出了一种用于跨场景分类的集成对齐子空间自适应&#xff08;EASA&#xff09;方法&#xff0c;它可以解决同谱异物和异谱同物的问题。该算法将集成学习的思想与域自适应&#xff08;DA&#xff09;算法相结合…

如何通过 Windows 图形界面找到 WSL 主目录

WSL(Windows Subsystem for Linux)是微软开发的一个软件层,用于在 Windows 11 或 10 上原生运行 Linux 二进制可执行文件。当你在 WSL 上安装一个 Linux 发行版时,它会在 Windows 内创建一个 Linux 环境,包括自己的文件系统和主目录。但是,如何通过 Windows 的图形文件资…

深入 MySQL 查询优化器:Optimizer Trace 分析

目录 一、前言 二、参数详解 optimizer_trace optimizer_trace_features optimizer_trace_max_mem_size optimizer_trace_limit optimizer_trace_offset 三、Optimizer Trace join_preparation join_optimization condition_processing substitute_generated_column…