找传奇、传世资源到传世资源站!

PDF分割、合并、旋转、加密小工具

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

对PDF文件进行加密、分割、合并。
from clipboard
from clipboard
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace PDFMergeAndSplitTool{ public partial class PDFCtrl : Form { public PDFCtrl() { InitializeComponent(); } private void btnSplit_Click(object sender, EventArgs e) { OpenFileDialog opflDlg = new OpenFileDialog(); opflDlg.Title = "选择需拆分的pdf文件(可多选)"; opflDlg.Filter = "PDF Files | *.pdf;*.PDF"; opflDlg.Multiselect = true; if (opflDlg.ShowDialog() == DialogResult.OK) { List<string> selectFiles = opflDlg.FileNames.ToList(); FolderBrowserDialog folderDialog = new FolderBrowserDialog(); folderDialog.Description = string.Format("请选择保存路径!\n用于保存分割文件"); if (folderDialog.ShowDialog() == DialogResult.OK) { string filePath = folderDialog.SelectedPath; selectFiles.ForEach( file => { YFASC_PDF.Instance.SplitPDF(file, filePath); }); } } } private void btnMerge_Click(object sender, EventArgs e) { OpenFileDialog opflDlg = new OpenFileDialog(); opflDlg.Title = "选择需合并的pdf文件(可多选)"; opflDlg.Filter = "PDF Files | *.pdf;*.PDF"; opflDlg.Multiselect = true; if (opflDlg.ShowDialog() == DialogResult.OK) { List<string> selectFiles = opflDlg.FileNames.ToList(); SaveFileDialog saveDiag = new SaveFileDialog(); saveDiag.Filter = "PDF Files | *.pdf;*.PDF"; saveDiag.Title = "保存合并文件"; if(saveDiag.ShowDialog()== DialogResult.OK) { YFASC_PDF.Instance.MergePDF(selectFiles, saveDiag.FileName); } } } private void btnRotate_Click(object sender, EventArgs e) { OpenFileDialog opflDlg = new OpenFileDialog(); opflDlg.Title = "选择需旋转的pdf文件(可多选)"; opflDlg.Filter = "PDF Files | *.pdf;*.PDF"; opflDlg.Multiselect = true; if (opflDlg.ShowDialog() == DialogResult.OK) { List<string> selectFiles = opflDlg.FileNames.ToList(); selectFiles.ForEach( file => { try { YFASC_PDF.Instance.RotatePDFPage(file, 90); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }); } } private void btnEncrypt_Click(object sender, EventArgs e) { OpenFileDialog opflDlg = new OpenFileDialog(); opflDlg.Title = "选择需加密的pdf文件(可多选)"; opflDlg.Filter = "PDF Files | *.pdf;*.PDF"; opflDlg.Multiselect = true; if (opflDlg.ShowDialog() == DialogResult.OK) { List<string> selectFiles = opflDlg.FileNames.ToList(); PasswordSet SettingDialog = new PDFMergeAndSplitTool.PasswordSet(); SettingDialog.StartPosition = FormStartPosition.CenterParent; if (SettingDialog.ShowDialog() == DialogResult.OK) { selectFiles.ForEach( file => { try { YFASC_PDF.Instance.EncryptPDFFile(file, SettingDialog.Password); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }); } } } private void btndecrypt_Click(object sender, EventArgs e) { OpenFileDialog opflDlg = new OpenFileDialog(); opflDlg.Title = "选择需消除密码的pdf文件"; opflDlg.Filter = "PDF Files | *.pdf;*.PDF"; opflDlg.Multiselect = false; if (opflDlg.ShowDialog() == DialogResult.OK) { List<string> selectFiles = opflDlg.FileNames.ToList(); PasswordSet SettingDialog = new PDFMergeAndSplitTool.PasswordSet(); SettingDialog.SetDialogInformation("取消密码", "确定", "文件密码:"); SettingDialog.StartPosition = FormStartPosition.CenterParent; if (SettingDialog.ShowDialog() == DialogResult.OK) { selectFiles.ForEach( file => { try { YFASC_PDF.Instance.CanclePDFPassWord(file, SettingDialog.Password); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }); } } } }}

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复