|
@@ -7,7 +7,6 @@ using ComPDFKit.Tool.SettingParam;
|
|
|
using Compdfkit_Tools.Edit;
|
|
|
using Compdfkit_Tools.Helper;
|
|
|
using ComPDFKitViewer;
|
|
|
-using Microsoft.Win32;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.ComponentModel;
|
|
@@ -16,8 +15,8 @@ using System.Drawing;
|
|
|
using System.IO;
|
|
|
using System.Runtime.CompilerServices;
|
|
|
using System.Windows;
|
|
|
-using System.Windows.Controls;
|
|
|
using System.Windows.Controls.Primitives;
|
|
|
+using System.Windows.Forms;
|
|
|
using System.Windows.Input;
|
|
|
using System.Windows.Media;
|
|
|
using static ComPDFKit.Tool.CPDFToolManager;
|
|
@@ -26,6 +25,12 @@ using ComPDFKit.Import;
|
|
|
using ComPDFKit.Tool.Help;
|
|
|
using ComPDFKit.Tool.UndoManger;
|
|
|
using ComPDFKit.Viewer.Helper;
|
|
|
+using ContextMenu = System.Windows.Controls.ContextMenu;
|
|
|
+using KeyEventArgs = System.Windows.Input.KeyEventArgs;
|
|
|
+using KeyEventHandler = System.Windows.Input.KeyEventHandler;
|
|
|
+using MenuItem = System.Windows.Controls.MenuItem;
|
|
|
+using OpenFileDialog = Microsoft.Win32.OpenFileDialog;
|
|
|
+using UserControl = System.Windows.Controls.UserControl;
|
|
|
|
|
|
namespace Compdfkit_Tools.PDFControl
|
|
|
{
|
|
@@ -721,28 +726,26 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
{
|
|
|
if (PdfViewControl != null && PdfViewControl.PDFView != null)
|
|
|
{
|
|
|
- PdfViewControl.PDFToolManager.GetSelectedEditAreaObject(ref index);
|
|
|
- Dictionary<int, List<System.Drawing.Bitmap>> imageDict = new Dictionary<int, List<Bitmap>>();
|
|
|
- if (imageDict != null && imageDict.Count > 0)
|
|
|
+ try
|
|
|
{
|
|
|
- System.Windows.Forms.FolderBrowserDialog folderBrowser = new System.Windows.Forms.FolderBrowserDialog();
|
|
|
- if (folderBrowser.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|
|
+ FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
|
|
|
+ if (folderBrowserDialog.ShowDialog() == DialogResult.OK && imageArea != null)
|
|
|
{
|
|
|
- string choosePath = folderBrowser.SelectedPath;
|
|
|
- string openPath = choosePath;
|
|
|
- foreach (int pageIndex in imageDict.Keys)
|
|
|
- {
|
|
|
- List<System.Drawing.Bitmap> imageList = imageDict[pageIndex];
|
|
|
- foreach (System.Drawing.Bitmap image in imageList)
|
|
|
- {
|
|
|
- string savePath = System.IO.Path.Combine(choosePath, Guid.NewGuid() + ".jpg");
|
|
|
- image.Save(savePath, System.Drawing.Imaging.ImageFormat.Jpeg);
|
|
|
- openPath = savePath;
|
|
|
- }
|
|
|
- }
|
|
|
- Process.Start("explorer", "/select,\"" + openPath + "\"");
|
|
|
+ string path = Path.GetTempPath();
|
|
|
+ string uuid = Guid.NewGuid().ToString("N");
|
|
|
+ string imagePath = Path.Combine(path, uuid + ".tmp");
|
|
|
+ imageArea.ExtractImage(imagePath);
|
|
|
+
|
|
|
+ Bitmap bitmapImage = new Bitmap(imagePath);
|
|
|
+ string fileName = Path.Combine(folderBrowserDialog.SelectedPath, uuid + ".jpg");
|
|
|
+ bitmapImage.Save(fileName, System.Drawing.Imaging.ImageFormat.Jpeg);
|
|
|
+ Process.Start("explorer", "/select,\"" + fileName + "\"");
|
|
|
}
|
|
|
}
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
menu.Items.Add(exportMenu);
|