資源簡介
1.文件不需下載
2.在線打開預覽
3.支持多種格式
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?System.IO;
using?org.pdfbox.pdmodel;
using?org.pdfbox.util;
namespace?FileConvert
{
????public?partial?class?ConvertFile?:?Form
????{
????????public?ConvertFile()
????????{
????????????InitializeComponent();
????????}
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????}
????????///?
????????///?pdf轉換txt
????????///?
????????///?
????????///?
????????private?void?BtnPdfToTxt_Click(object?sender?EventArgs?e)
????????{
????????????try
????????????{
????????????????OpenFileDialog?openfile?=?new?OpenFileDialog();
????????????????openfile.Multiselect?=?true;
????????????????openfile.title?=?“文件轉換“;
????????????????openfile.Filter?=?“PDF文檔(*.pdf)|?*.pdf“;
????????????????openfile.RestoreDirectory?=?false;
????????????????if?(openfile.ShowDialog()?!=?System.Windows.Forms.DialogResult.OK)
????????????????????return;
????????????????string?fName?=?openfile.FileName;
????????????????FileInfo?fi?=?new?FileInfo(fName);
????????????????this.Text?=?(fi.Length?/?1024).ToString()?+?“kb“;
????????????????if?((fi.Length?/?1024)?>?1024)
????????????????{
????????????????????MessageBox.Show(“文件大小超過可轉換大小“);
????????????????????return;
????????????????}
????????????????PDDocument?doc?=?PDDocument.load(fName);
????????????????PDFTextStripper?pdfStripper?=?new?PDFTextStripper();
????????????????string?text?=?pdfStripper.getText(doc);
????????????????StreamWriter?swPdfChange?=?new?StreamWriter(System.IO.Path.GetFileNameWithoutExtension(fName)?+?“.txt“?false?Encoding.GetEncoding(“gb2312“));
????????????????swPdfChange.Write(text);
????????????????swPdfChange.Close();
????????????????MessageBox.Show(System.IO.Path.GetFileNameWithoutExtension(fName.ToString())?+?“?文件轉換成功“);
????????????}
????????????catch?(Exception?ex)
????????????{
????????????????MessageBox.Show(“轉換異常:“?+?ex.Message);
????????????????return;
????????????}
????????}
????????///?
????????///?切割pdf
????????///?
????????///?
????????///?
????????private?void?BtnSplit_Click(object?sender?EventArgs?e)
????????{
????????????try
????????????{
????????????????//OpenFileDialog?openfile?=?new?OpenFileDialog();
????????????????//openfile.Multiselect?=?true;
????????????????//openfile.title?=?“選擇切割的pdf文件“;
????????????????//openfile.Filter?=?“PDF文檔(*.pdf)|?*.pdf“;
????????????????//openfile.RestoreDirectory?=?false;
????????????????//if?(openfile.ShowDialog()?!=?System.Windows.Forms.DialogResult.OK)
????????????????//????return;
????????????????//string?fName?=?openfile.FileName;
????????????????//Spire.Pdf.PdfDocument?doc?=?new?Spire.Pdf.PdfDocument();
????????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????7680??2019-04-16?15:07??ScanningFile\bin\Debug\ScanningFile.exe
?????文件??????19968??2019-04-16?15:07??ScanningFile\bin\Debug\ScanningFile.pdb
?????文件????????437??2019-04-12?15:52??ScanningFile\FileScanning.cs
?????文件???????1596??2019-04-12?09:00??ScanningFile\FileScanning.Designer.cs
?????文件???????5817??2019-04-12?09:00??ScanningFile\FileScanning.resx
?????文件???????6296??2019-04-16?17:16??ScanningFile\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件????????641??2019-04-16?15:07??ScanningFile\obj\x86\Debug\ScanningFile.csproj.FileListAbsolute.txt
?????文件????????982??2019-04-16?15:07??ScanningFile\obj\x86\Debug\ScanningFile.csproj.GenerateResource.Cache
?????文件???????9174??2019-04-16?15:07??ScanningFile\obj\x86\Debug\ScanningFile.csprojResolveAssemblyReference.cache
?????文件???????7680??2019-04-16?15:07??ScanningFile\obj\x86\Debug\ScanningFile.exe
?????文件????????180??2019-04-16?15:07??ScanningFile\obj\x86\Debug\ScanningFile.FileScanning.resources
?????文件??????19968??2019-04-16?15:07??ScanningFile\obj\x86\Debug\ScanningFile.pdb
?????文件????????180??2019-04-16?15:07??ScanningFile\obj\x86\Debug\ScanningFile.Properties.Resources.resources
?????文件????????500??2019-04-12?09:00??ScanningFile\Program.cs
?????文件???????1356??2019-04-12?08:58??ScanningFile\Properties\AssemblyInfo.cs
?????文件???????2876??2019-04-12?08:58??ScanningFile\Properties\Resources.Designer.cs
?????文件???????5612??2019-04-12?08:58??ScanningFile\Properties\Resources.resx
?????文件???????1099??2019-04-12?08:58??ScanningFile\Properties\Settings.Designer.cs
?????文件????????249??2019-04-12?08:58??ScanningFile\Properties\Settings.settings
?????文件???????3718??2019-04-12?09:00??ScanningFile\ScanningFile.csproj
?????文件???????1779??2019-04-17?09:03??OpenFile.sln
?????文件????8018944??2014-11-23?14:59??FileConvert\bin\Debug\Aspose.Cells.dll
?????文件???11615232??2018-12-18?14:35??FileConvert\bin\Debug\Aspose.Words.dll
?????文件?????151552??2006-10-12?12:20??FileConvert\bin\Debug\bcmail-jdk14-132.dll
?????文件????1187840??2006-10-12?12:20??FileConvert\bin\Debug\bcprov-jdk14-132.dll
?????文件??????11264??2019-04-16?15:07??FileConvert\bin\Debug\FileConvert.exe
?????文件??????24064??2019-04-16?15:07??FileConvert\bin\Debug\FileConvert.pdb
?????文件??????11600??2019-04-15?14:05??FileConvert\bin\Debug\FileConvert.vshost.exe
?????文件????????490??2016-07-16?19:44??FileConvert\bin\Debug\FileConvert.vshost.exe.manifest
?????文件??????86016??2006-10-12?12:20??FileConvert\bin\Debug\FontBox-0.1.0-dev.dll
............此處省略129個文件信息
評論
共有 條評論