|
@@ -2,8 +2,6 @@
|
|
|
using Compdfkit_Tools.Helper;
|
|
|
using Compdfkit_Tools.PDFControl;
|
|
|
using ComPDFKitViewer;
|
|
|
-using ComPDFKitViewer.AnnotEvent;
|
|
|
-using ComPDFKitViewer.PdfViewer;
|
|
|
using Microsoft.Win32;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
@@ -38,9 +36,13 @@ namespace Viewer
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
- if (pdfViewControl != null && pdfViewControl.PDFView != null)
|
|
|
+ if (pdfViewControl != null && pdfViewControl.PDFViewTool.GetCPDFViewer() != null)
|
|
|
{
|
|
|
- return pdfViewControl.PDFView.UndoManager.CanSave;
|
|
|
+ if (pdfViewControl.PDFViewTool.GetCPDFViewer().UndoManager.CanRedo ||
|
|
|
+ pdfViewControl.PDFViewTool.GetCPDFViewer().UndoManager.CanUndo)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
@@ -63,11 +65,11 @@ namespace Viewer
|
|
|
#region Load Document
|
|
|
private void LoadDocument()
|
|
|
{
|
|
|
- if (pdfViewControl.PDFView.Document == null)
|
|
|
+ if (pdfViewControl.PDFToolManager.GetDocument() == null)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
- pdfViewControl.PDFView?.SetMouseMode(MouseModes.Viewer);
|
|
|
+ pdfViewControl.PDFToolManager?.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.Viewer);
|
|
|
pdfViewControl.PDFView?.Load();
|
|
|
pdfViewControl.PDFView?.SetShowLink(true);
|
|
|
PDFGrid.Child = pdfViewControl;
|
|
@@ -85,12 +87,12 @@ namespace Viewer
|
|
|
PasswordUI.Canceled += PasswordUI_Canceled;
|
|
|
PasswordUI.Confirmed += PasswordUI_Confirmed;
|
|
|
|
|
|
- pdfViewControl.PDFView.ChangeFitMode(FitMode.FitWidth);
|
|
|
- CPDFSaclingControl.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
|
- CPDFSaclingControl.SetZoomTextBoxText(string.Format("{0}", (int)(pdfViewControl.PDFView.ZoomFactor * 100)));
|
|
|
+ pdfViewControl.PDFViewTool.GetCPDFViewer().SetFitMode(FitModes.FitWidth);
|
|
|
+ CPDFSaclingControl.InitWithPDFViewer(pdfViewControl);
|
|
|
+ CPDFSaclingControl.SetZoomTextBoxText(string.Format("{0}", (int)(pdfViewControl.PDFViewTool.GetCPDFViewer().GetZoom() * 100)));
|
|
|
|
|
|
- FloatPageTool.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
|
- BotaSideTool.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
|
+ FloatPageTool.InitWithPDFViewer(pdfViewControl);
|
|
|
+ BotaSideTool.InitWithPDFViewer(pdfViewControl);
|
|
|
BotaSideTool.SelectBotaTool(BOTATools.Thumbnail);
|
|
|
ViewSettingBtn.IsChecked = false;
|
|
|
PropertyContainer.Child = null;
|
|
@@ -101,7 +103,7 @@ namespace Viewer
|
|
|
{
|
|
|
string defaultFilePath = "PDF32000_2008.pdf";
|
|
|
pdfViewControl = new PDFViewControl();
|
|
|
- pdfViewControl.PDFView.InitDocument(defaultFilePath);
|
|
|
+ pdfViewControl.InitDocument(defaultFilePath);
|
|
|
LoadDocument();
|
|
|
}
|
|
|
#endregion
|
|
@@ -109,10 +111,10 @@ namespace Viewer
|
|
|
#region Password
|
|
|
private void PasswordUI_Confirmed(object sender, string e)
|
|
|
{
|
|
|
- if (passwordViewer != null && passwordViewer.PDFView != null && passwordViewer.PDFView.Document != null)
|
|
|
+ if (passwordViewer != null && passwordViewer.PDFToolManager != null && passwordViewer.PDFToolManager.GetDocument() != null)
|
|
|
{
|
|
|
- passwordViewer.PDFView.Document.UnlockWithPassword(e);
|
|
|
- if (passwordViewer.PDFView.Document.IsLocked == false)
|
|
|
+ passwordViewer.PDFToolManager.GetDocument().UnlockWithPassword(e);
|
|
|
+ if (passwordViewer.PDFToolManager.GetDocument().IsLocked == false)
|
|
|
{
|
|
|
PasswordUI.SetShowError("", Visibility.Collapsed);
|
|
|
PasswordUI.ClearPassword();
|
|
@@ -222,7 +224,7 @@ namespace Viewer
|
|
|
{
|
|
|
if (ViewSettingBtn.IsChecked == true)
|
|
|
{
|
|
|
- displayPanel.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
|
+ displayPanel.InitWithPDFViewer(pdfViewControl);
|
|
|
PropertyContainer.Child = displayPanel;
|
|
|
PropertyContainer.Visibility = Visibility.Visible;
|
|
|
}
|
|
@@ -243,8 +245,8 @@ namespace Viewer
|
|
|
{
|
|
|
if (pdfViewControl != null)
|
|
|
{
|
|
|
- double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor + 0.01, true);
|
|
|
- pdfViewControl.PDFView.Zoom(newZoom);
|
|
|
+ double newZoom = CheckZoomLevel(pdfViewControl.PDFViewTool.GetCPDFViewer().GetZoom() + 0.01, true);
|
|
|
+ pdfViewControl.PDFViewTool.GetCPDFViewer().SetZoom(newZoom);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -252,26 +254,26 @@ namespace Viewer
|
|
|
{
|
|
|
if (pdfViewControl != null)
|
|
|
{
|
|
|
- double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor - 0.01, false);
|
|
|
- pdfViewControl.PDFView.Zoom(newZoom);
|
|
|
+ double newZoom = CheckZoomLevel(pdfViewControl.PDFViewTool.GetCPDFViewer().GetZoom() - 0.01, false);
|
|
|
+ pdfViewControl.PDFViewTool.GetCPDFViewer().SetZoom(newZoom);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void NextPageBorder_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
|
|
{
|
|
|
- pdfViewControl.PDFView?.GoToPage(pdfViewControl.PDFView.CurrentIndex + 1);
|
|
|
+ pdfViewControl.PDFViewTool.GetCPDFViewer()?.GoToPage(pdfViewControl.PDFViewTool.GetCPDFViewer().CurrentRenderFrame.PageIndex + 1,new System.Windows.Point(0,0));
|
|
|
}
|
|
|
|
|
|
private void PrevPageBorder_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
|
|
{
|
|
|
- pdfViewControl.PDFView?.GoToPage(pdfViewControl.PDFView.CurrentIndex - 1);
|
|
|
+ pdfViewControl.PDFViewTool.GetCPDFViewer()?.GoToPage(pdfViewControl.PDFViewTool.GetCPDFViewer().CurrentRenderFrame.PageIndex - 1, new System.Windows.Point(0, 0));
|
|
|
}
|
|
|
|
|
|
private void PageInfoBtn_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
PasswordUI.Visibility = Visibility.Collapsed;
|
|
|
FileInfoUI.Visibility = Visibility.Visible;
|
|
|
- FileInfoControl.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
|
+ FileInfoControl.InitWithPDFViewer(pdfViewControl);
|
|
|
PopupBorder.Visibility = Visibility.Visible;
|
|
|
}
|
|
|
|
|
@@ -289,9 +291,9 @@ namespace Viewer
|
|
|
public void SaveAsFile()
|
|
|
{
|
|
|
{
|
|
|
- if (pdfViewControl != null && pdfViewControl.PDFView != null && pdfViewControl.PDFView.Document != null)
|
|
|
+ if (pdfViewControl != null && pdfViewControl.PDFToolManager != null && pdfViewControl.PDFToolManager.GetDocument() != null)
|
|
|
{
|
|
|
- CPDFDocument pdfDoc = pdfViewControl.PDFView.Document;
|
|
|
+ CPDFDocument pdfDoc = pdfViewControl.PDFToolManager.GetDocument();
|
|
|
SaveFileDialog saveDialog = new SaveFileDialog();
|
|
|
saveDialog.Filter = "(*.pdf)|*.pdf";
|
|
|
saveDialog.DefaultExt = ".pdf";
|
|
@@ -307,7 +309,7 @@ namespace Viewer
|
|
|
|
|
|
private void SaveFile()
|
|
|
{
|
|
|
- if (pdfViewControl != null && pdfViewControl.PDFView != null && pdfViewControl.PDFView.Document != null)
|
|
|
+ if (pdfViewControl != null && pdfViewControl.PDFToolManager != null && pdfViewControl.PDFToolManager.GetDocument() != null)
|
|
|
{
|
|
|
CPDFDocument pdfDoc = pdfViewControl.PDFView.Document;
|
|
|
if (pdfDoc.WriteToLoadedPath())
|