|
@@ -1,20 +1,17 @@
|
|
|
-using System;
|
|
|
+using ComPDFKit.PDFDocument;
|
|
|
+using Compdfkit_Tools.Helper;
|
|
|
+using Compdfkit_Tools.PDFControl;
|
|
|
+using Compdfkit_Tools.PDFView;
|
|
|
+using ComPDFKitViewer;
|
|
|
+using Microsoft.Win32;
|
|
|
+using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.ComponentModel;
|
|
|
using System.Runtime.CompilerServices;
|
|
|
using System.Windows;
|
|
|
using System.Windows.Controls;
|
|
|
using System.Windows.Controls.Primitives;
|
|
|
-using Compdfkit_Tools.Helper;
|
|
|
-using Compdfkit_Tools.PDFControl;
|
|
|
-using Compdfkit_Tools.PDFView;
|
|
|
-using ComPDFKit.PDFDocument;
|
|
|
-using ComPDFKit.PDFPage;
|
|
|
-using ComPDFKitViewer;
|
|
|
-using ComPDFKitViewer.PdfViewer;
|
|
|
-using Microsoft.Win32;
|
|
|
using System.Windows.Input;
|
|
|
-using ComPDFKitViewer.AnnotEvent;
|
|
|
|
|
|
namespace PDFViewer
|
|
|
{
|
|
@@ -25,7 +22,7 @@ namespace PDFViewer
|
|
|
private string currentMode = "Viewer";
|
|
|
private double[] zoomLevelList = { 1f, 8f, 12f, 25, 33f, 50, 66f, 75, 100, 125, 150, 200, 300, 400, 600, 800, 1000 };
|
|
|
|
|
|
- private PDFViewControl pdfViewer;
|
|
|
+ private PDFViewControl viewControl;
|
|
|
private PDFViewControl passwordViewer;
|
|
|
private RegularViewerControl regularViewerControl = new RegularViewerControl();
|
|
|
private AnnotationControl annotationControl = new AnnotationControl();
|
|
@@ -131,8 +128,8 @@ namespace PDFViewer
|
|
|
/// <param name="filePath"></param>
|
|
|
public void InitWithFilePath(string filePath)
|
|
|
{
|
|
|
- pdfViewer = new PDFViewControl();
|
|
|
- pdfViewer.PDFView.InitDocument(filePath);
|
|
|
+ viewControl = new PDFViewControl();
|
|
|
+ viewControl.InitDocument(filePath);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -140,37 +137,43 @@ namespace PDFViewer
|
|
|
/// </summary>
|
|
|
private void LoadDocument()
|
|
|
{
|
|
|
- if (pdfViewer.PDFView.Document == null)
|
|
|
+ if (viewControl != null && viewControl.PDFViewTool != null)
|
|
|
{
|
|
|
- return;
|
|
|
- }
|
|
|
- pdfViewer.PDFView.Load();
|
|
|
- pdfViewer.PDFView.SetShowLink(true);
|
|
|
+ CPDFViewer pdfviewer = viewControl.PDFViewTool.GetCPDFViewer();
|
|
|
+ CPDFDocument pdfDoc = pdfviewer?.GetDocument();
|
|
|
+ if (pdfDoc == null)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- pdfViewer.PDFView.InfoChanged -= PdfViewer_InfoChanged;
|
|
|
- pdfViewer.PDFView.InfoChanged += PdfViewer_InfoChanged;
|
|
|
+ //viewControl.PDFView.Load();
|
|
|
+ //viewControl.PDFView.SetShowLink(true);
|
|
|
|
|
|
- pdfViewer.PDFView.SetFormFieldHighlight(true);
|
|
|
- PasswordUI.Closed -= PasswordUI_Closed;
|
|
|
- PasswordUI.Canceled -= PasswordUI_Canceled;
|
|
|
- PasswordUI.Confirmed -= PasswordUI_Confirmed;
|
|
|
- PasswordUI.Closed += PasswordUI_Closed;
|
|
|
- PasswordUI.Canceled += PasswordUI_Canceled;
|
|
|
- PasswordUI.Confirmed += PasswordUI_Confirmed;
|
|
|
+ //viewControl.PDFView.InfoChanged -= PdfViewer_InfoChanged;
|
|
|
+ //viewControl.PDFView.InfoChanged += PdfViewer_InfoChanged;
|
|
|
|
|
|
- pdfViewer.PDFView.ChangeFitMode(FitMode.FitWidth);
|
|
|
- CPDFSaclingControl.InitWithPDFViewer(pdfViewer.PDFView);
|
|
|
- ModeComboBox.SelectedIndex = 0;
|
|
|
+ //viewControl.PDFView.SetFormFieldHighlight(true);
|
|
|
+ PasswordUI.Closed -= PasswordUI_Closed;
|
|
|
+ PasswordUI.Canceled -= PasswordUI_Canceled;
|
|
|
+ PasswordUI.Confirmed -= PasswordUI_Confirmed;
|
|
|
+ PasswordUI.Closed += PasswordUI_Closed;
|
|
|
+ PasswordUI.Canceled += PasswordUI_Canceled;
|
|
|
+ PasswordUI.Confirmed += PasswordUI_Confirmed;
|
|
|
|
|
|
- CPDFSaclingControl.SetZoomTextBoxText(string.Format("{0}", (int)(pdfViewer.PDFView.ZoomFactor * 100)));
|
|
|
+ //viewControl.PDFView.ChangeFitMode(FitMode.FitWidth);
|
|
|
+ CPDFSaclingControl.InitWithPDFViewer(viewControl);
|
|
|
+ ModeComboBox.SelectedIndex = 0;
|
|
|
|
|
|
- ViewSettingBtn.IsChecked = false;
|
|
|
- botaBarControl.InitWithPDFViewer(pdfViewer.PDFView);
|
|
|
- botaBarControl.SelectBotaTool(BOTATools.Thumbnail);
|
|
|
- displaySettingsControl.InitWithPDFViewer(pdfViewer.PDFView);
|
|
|
- LoadCustomControl();
|
|
|
- panelState.PropertyChanged -= PanelState_PropertyChanged;
|
|
|
- panelState.PropertyChanged += PanelState_PropertyChanged;
|
|
|
+ CPDFSaclingControl.SetZoomTextBoxText(string.Format("{0}", (int)(pdfviewer.GetZoom() * 100)));
|
|
|
+
|
|
|
+ ViewSettingBtn.IsChecked = false;
|
|
|
+ botaBarControl.InitWithPDFViewer(viewControl);
|
|
|
+ botaBarControl.SelectBotaTool(BOTATools.Thumbnail);
|
|
|
+ displaySettingsControl.InitWithPDFViewer(viewControl);
|
|
|
+ LoadCustomControl();
|
|
|
+ panelState.PropertyChanged -= PanelState_PropertyChanged;
|
|
|
+ panelState.PropertyChanged += PanelState_PropertyChanged;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -191,7 +194,7 @@ namespace PDFViewer
|
|
|
{
|
|
|
if (newPdfViewer != null)
|
|
|
{
|
|
|
- pdfViewer = newPdfViewer;
|
|
|
+ viewControl = newPdfViewer;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -206,16 +209,23 @@ namespace PDFViewer
|
|
|
/// <param name="e"></param>
|
|
|
private void PasswordUI_Confirmed(object sender, string e)
|
|
|
{
|
|
|
- if (passwordViewer != null && passwordViewer.PDFView != null && passwordViewer.PDFView.Document != null)
|
|
|
+ if (passwordViewer != null && passwordViewer.PDFViewTool != null)
|
|
|
{
|
|
|
- passwordViewer.PDFView.Document.UnlockWithPassword(e);
|
|
|
- if (passwordViewer.PDFView.Document.IsLocked == false)
|
|
|
+ CPDFViewer pdfviewer = passwordViewer.PDFViewTool.GetCPDFViewer();
|
|
|
+ CPDFDocument pdfDoc = pdfviewer?.GetDocument();
|
|
|
+ if (pdfDoc == null)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ pdfDoc.UnlockWithPassword(e);
|
|
|
+ if (pdfDoc.IsLocked == false)
|
|
|
{
|
|
|
PasswordUI.SetShowError("", Visibility.Collapsed);
|
|
|
PasswordUI.ClearPassword();
|
|
|
PasswordUI.Visibility = Visibility.Collapsed;
|
|
|
PopupBorder.Visibility = Visibility.Collapsed;
|
|
|
- pdfViewer = passwordViewer;
|
|
|
+ viewControl = passwordViewer;
|
|
|
LoadDocument();
|
|
|
FileChangeEvent?.Invoke(null, EventArgs.Empty);
|
|
|
}
|
|
@@ -257,11 +267,11 @@ namespace PDFViewer
|
|
|
/// </summary>
|
|
|
private void LoadCustomControl()
|
|
|
{
|
|
|
- regularViewerControl.PdfViewControl = pdfViewer;
|
|
|
+ regularViewerControl.PdfViewControl = viewControl;
|
|
|
regularViewerControl.OnCanSaveChanged -= ControlOnCanSaveChanged;
|
|
|
regularViewerControl.OnCanSaveChanged += ControlOnCanSaveChanged;
|
|
|
- regularViewerControl.InitWithPDFViewer(pdfViewer.PDFView);
|
|
|
- regularViewerControl.PdfViewControl.PDFView.SetMouseMode(MouseModes.Viewer);
|
|
|
+ regularViewerControl.InitWithPDFViewer(viewControl);
|
|
|
+ //regularViewerControl.PdfViewControl.PDFView.SetMouseMode(MouseModes.Viewer);
|
|
|
regularViewerControl.SetBOTAContainer(null);
|
|
|
regularViewerControl.SetBOTAContainer(botaBarControl);
|
|
|
regularViewerControl.SetDisplaySettingsControl(displaySettingsControl);
|
|
@@ -307,11 +317,6 @@ namespace PDFViewer
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if(pdfViewer!=null && pdfViewer.PDFView!=null)
|
|
|
- {
|
|
|
- // pdfViewer.PDFView.ToolManager.EnableClickCreate = false;
|
|
|
- }
|
|
|
-
|
|
|
if (currentMode == "Viewer")
|
|
|
{
|
|
|
regularViewerControl.ClearViewerControl();
|
|
@@ -339,12 +344,12 @@ namespace PDFViewer
|
|
|
|
|
|
if (item.Content as string == "Viewer")
|
|
|
{
|
|
|
- if (regularViewerControl.PdfViewControl != null && regularViewerControl.PdfViewControl.PDFView != null)
|
|
|
+ if (regularViewerControl.PdfViewControl != null)
|
|
|
{
|
|
|
PDFGrid.Child = regularViewerControl;
|
|
|
- pdfViewer.PDFView.SetMouseMode(MouseModes.Viewer);
|
|
|
- regularViewerControl.PdfViewControl = pdfViewer;
|
|
|
- regularViewerControl.InitWithPDFViewer(pdfViewer.PDFView);
|
|
|
+ //viewControl.PDFView.SetMouseMode(MouseModes.Viewer);
|
|
|
+ regularViewerControl.PdfViewControl = viewControl;
|
|
|
+ regularViewerControl.InitWithPDFViewer(viewControl);
|
|
|
regularViewerControl.OnCanSaveChanged -= ControlOnCanSaveChanged;
|
|
|
regularViewerControl.OnCanSaveChanged += ControlOnCanSaveChanged;
|
|
|
regularViewerControl.SetBOTAContainer(botaBarControl);
|
|
@@ -354,13 +359,13 @@ namespace PDFViewer
|
|
|
else if (item.Content as string == "Annotation")
|
|
|
{
|
|
|
annotationControl.SetToolBarContainerVisibility(Visibility.Visible);
|
|
|
- if (annotationControl.PDFViewControl != null && annotationControl.PDFViewControl.PDFView != null)
|
|
|
+ if (annotationControl.PDFViewControl != null)
|
|
|
{
|
|
|
PDFGrid.Child = annotationControl;
|
|
|
- pdfViewer.PDFView.SetMouseMode(MouseModes.AnnotCreate);
|
|
|
- annotationControl.PDFViewControl.PDFView.SetToolParam(new AnnotHandlerEventArgs());
|
|
|
- annotationControl.PDFViewControl = pdfViewer;
|
|
|
- annotationControl.InitWithPDFViewer(pdfViewer.PDFView);
|
|
|
+ //viewControl.PDFView.SetMouseMode(MouseModes.AnnotCreate);
|
|
|
+ //annotationControl.PDFViewControl.PDFView.SetToolParam(new AnnotHandlerEventArgs());
|
|
|
+ annotationControl.PDFViewControl = viewControl;
|
|
|
+ //annotationControl.InitWithPDFViewer(viewControl);
|
|
|
annotationControl.OnCanSaveChanged -= ControlOnCanSaveChanged;
|
|
|
annotationControl.OnCanSaveChanged += ControlOnCanSaveChanged;
|
|
|
annotationControl.OnAnnotEditHandler -= PdfFormControlRefreshAnnotList;
|
|
@@ -373,12 +378,12 @@ namespace PDFViewer
|
|
|
else if (item.Content as string == "Form")
|
|
|
{
|
|
|
formControl.SetToolBarContainerVisibility(Visibility.Visible);
|
|
|
- if (formControl.PdfViewControl != null && formControl.PdfViewControl.PDFView != null)
|
|
|
+ if (formControl.PdfViewControl != null )
|
|
|
{
|
|
|
PDFGrid.Child = formControl;
|
|
|
- pdfViewer.PDFView.SetMouseMode(MouseModes.FormEditTool);
|
|
|
- formControl.PdfViewControl = pdfViewer;
|
|
|
- formControl.InitWithPDFViewer(pdfViewer.PDFView);
|
|
|
+ //viewControl.PDFView.SetMouseMode(MouseModes.FormEditTool);
|
|
|
+ formControl.PdfViewControl = viewControl;
|
|
|
+ formControl.InitWithPDFViewer(viewControl);
|
|
|
formControl.OnCanSaveChanged -= ControlOnCanSaveChanged;
|
|
|
formControl.OnCanSaveChanged += ControlOnCanSaveChanged;
|
|
|
formControl.OnAnnotEditHandler -= PdfFormControlRefreshAnnotList;
|
|
@@ -390,19 +395,17 @@ namespace PDFViewer
|
|
|
}
|
|
|
else if (item.Content as string == "Content Editor")
|
|
|
{
|
|
|
- if (contentEditControl.pdfContentEditControl != null && contentEditControl.PdfViewControl.PDFView != null)
|
|
|
+ if (contentEditControl.pdfContentEditControl != null && contentEditControl.PdfViewControl!= null)
|
|
|
{
|
|
|
- pdfViewer.PDFView?.SetPDFEditType(CPDFEditType.EditText | CPDFEditType.EditImage);
|
|
|
- pdfViewer.PDFView?.SetPDFEditCreateType(CPDFEditType.None);
|
|
|
- pdfViewer.PDFView?.SetMouseMode(MouseModes.PDFEdit);
|
|
|
- pdfViewer.PDFView?.ReloadDocument();
|
|
|
-
|
|
|
- pdfViewer.PDFView?.SetSplitMode(SplitMode.None);
|
|
|
+ //viewControl.PDFView?.SetPDFEditType(CPDFEditType.EditText | CPDFEditType.EditImage);
|
|
|
+ //viewControl.PDFView?.SetPDFEditCreateType(CPDFEditType.None);
|
|
|
+ //viewControl.PDFView?.SetMouseMode(MouseModes.PDFEdit);
|
|
|
+ //viewControl.PDFView?.ReloadDocument();
|
|
|
|
|
|
PDFGrid.Child = contentEditControl;
|
|
|
- pdfViewer.PDFView.SetMouseMode(MouseModes.PDFEdit);
|
|
|
- contentEditControl.PdfViewControl = pdfViewer;
|
|
|
- contentEditControl.InitWithPDFViewer(pdfViewer.PDFView);
|
|
|
+ // viewControl.PDFView.SetMouseMode(MouseModes.PDFEdit);
|
|
|
+ contentEditControl.PdfViewControl = viewControl;
|
|
|
+ contentEditControl.InitWithPDFViewer(viewControl);
|
|
|
contentEditControl.OnCanSaveChanged -= ControlOnCanSaveChanged;
|
|
|
contentEditControl.OnCanSaveChanged += ControlOnCanSaveChanged;
|
|
|
contentEditControl.SetBOTAContainer(botaBarControl);
|
|
@@ -411,7 +414,7 @@ namespace PDFViewer
|
|
|
}
|
|
|
else if (item.Content as string == "Docs Editor")
|
|
|
{
|
|
|
- pageEditControl.PDFViewControl = pdfViewer;
|
|
|
+ pageEditControl.PDFViewControl = viewControl;
|
|
|
pageEditControl.ExitPageEdit += PageEditControl_ExitPageEdit;
|
|
|
PDFGrid.Child = pageEditControl;
|
|
|
NotDocsEditorVisible = Visibility.Collapsed;
|
|
@@ -429,7 +432,7 @@ namespace PDFViewer
|
|
|
{
|
|
|
PasswordUI.Visibility = Visibility.Collapsed;
|
|
|
FileInfoUI.Visibility = Visibility.Visible;
|
|
|
- FileInfoControl.InitWithPDFViewer(pdfViewer.PDFView);
|
|
|
+ FileInfoControl.InitWithPDFViewer(viewControl);
|
|
|
PopupBorder.Visibility = Visibility.Visible;
|
|
|
}
|
|
|
|
|
@@ -517,50 +520,58 @@ namespace PDFViewer
|
|
|
private void SaveFileBtn_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
SaveFile();
|
|
|
- pdfViewer.PDFView.UndoManager.CanSave = false;
|
|
|
}
|
|
|
|
|
|
private void OpenFile()
|
|
|
{
|
|
|
- string filePath = CommonHelper.GetExistedPathOrEmpty();
|
|
|
- string oldFilePath = pdfViewer.PDFView.Document.FilePath;
|
|
|
-
|
|
|
- if (!string.IsNullOrEmpty(filePath) && regularViewerControl.PdfViewControl != null)
|
|
|
+ if (viewControl != null && viewControl.PDFViewTool != null)
|
|
|
{
|
|
|
- if (pdfViewer.PDFView != null && pdfViewer.PDFView.Document != null)
|
|
|
+ CPDFViewer pdfviewer = viewControl.PDFViewTool.GetCPDFViewer();
|
|
|
+ CPDFDocument pdfDoc = pdfviewer?.GetDocument();
|
|
|
+ if (pdfDoc == null)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ string filePath = CommonHelper.GetExistedPathOrEmpty();
|
|
|
+ string oldFilePath = pdfDoc.FilePath;
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(filePath) && regularViewerControl.PdfViewControl != null)
|
|
|
{
|
|
|
if (oldFilePath.ToLower() == filePath.ToLower())
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- if ((bool)CheckExistBeforeOpenFileEvent?.Invoke(new string[] { filePath, oldFilePath }))
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
+ if ((bool)CheckExistBeforeOpenFileEvent?.Invoke(new string[] { filePath, oldFilePath }))
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- passwordViewer = new PDFViewControl();
|
|
|
- passwordViewer.PDFView.InitDocument(filePath);
|
|
|
- if (passwordViewer.PDFView.Document == null)
|
|
|
- {
|
|
|
- MessageBox.Show("Open File Failed");
|
|
|
- return;
|
|
|
- }
|
|
|
+ passwordViewer = new PDFViewControl();
|
|
|
+ passwordViewer.InitDocument(filePath);
|
|
|
+ CPDFViewer tempViewer = passwordViewer.PDFViewTool?.GetCPDFViewer();
|
|
|
+ CPDFDocument tempDoc = tempViewer?.GetDocument();
|
|
|
+ if (tempDoc == null)
|
|
|
+ {
|
|
|
+ MessageBox.Show("Open File Failed");
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- if (passwordViewer.PDFView.Document.IsLocked)
|
|
|
- {
|
|
|
- PasswordUI.SetShowText(System.IO.Path.GetFileName(filePath) + " password encrypted.");
|
|
|
- PasswordUI.ClearPassword();
|
|
|
- PopupBorder.Visibility = Visibility.Visible;
|
|
|
- PasswordUI.Visibility = Visibility.Visible;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- pdfViewer.PDFView.Document.Release();
|
|
|
- pdfViewer = passwordViewer;
|
|
|
- LoadDocument();
|
|
|
- FileChangeEvent?.Invoke(null, EventArgs.Empty);
|
|
|
+ if (tempDoc.IsLocked)
|
|
|
+ {
|
|
|
+ PasswordUI.SetShowText(System.IO.Path.GetFileName(filePath) + " password encrypted.");
|
|
|
+ PasswordUI.ClearPassword();
|
|
|
+ PopupBorder.Visibility = Visibility.Visible;
|
|
|
+ PasswordUI.Visibility = Visibility.Visible;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pdfDoc.Release();
|
|
|
+ viewControl = passwordViewer;
|
|
|
+ LoadDocument();
|
|
|
+ FileChangeEvent?.Invoke(null, EventArgs.Empty);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -575,19 +586,23 @@ namespace PDFViewer
|
|
|
/// </summary>
|
|
|
public void SaveAsFile()
|
|
|
{
|
|
|
+ if (viewControl != null && viewControl.PDFViewTool != null)
|
|
|
{
|
|
|
- if (pdfViewer != null && pdfViewer.PDFView != null && pdfViewer.PDFView.Document != null)
|
|
|
+ CPDFViewer pdfviewer = viewControl.PDFViewTool.GetCPDFViewer();
|
|
|
+ CPDFDocument pdfDoc = pdfviewer?.GetDocument();
|
|
|
+ if (pdfDoc == null)
|
|
|
{
|
|
|
- CPDFDocument pdfDoc = pdfViewer.PDFView.Document;
|
|
|
- SaveFileDialog saveDialog = new SaveFileDialog();
|
|
|
- saveDialog.Filter = "(*.pdf)|*.pdf";
|
|
|
- saveDialog.DefaultExt = ".pdf";
|
|
|
- saveDialog.OverwritePrompt = true;
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- if (saveDialog.ShowDialog() == true)
|
|
|
- {
|
|
|
- pdfDoc.WriteToFilePath(saveDialog.FileName);
|
|
|
- }
|
|
|
+ SaveFileDialog saveDialog = new SaveFileDialog();
|
|
|
+ saveDialog.Filter = "(*.pdf)|*.pdf";
|
|
|
+ saveDialog.DefaultExt = ".pdf";
|
|
|
+ saveDialog.OverwritePrompt = true;
|
|
|
+
|
|
|
+ if (saveDialog.ShowDialog() == true)
|
|
|
+ {
|
|
|
+ pdfDoc.WriteToFilePath(saveDialog.FileName);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -597,11 +612,16 @@ namespace PDFViewer
|
|
|
/// </summary>
|
|
|
public void SaveFile()
|
|
|
{
|
|
|
- if (pdfViewer != null && pdfViewer.PDFView != null && pdfViewer.PDFView.Document != null)
|
|
|
+ if (viewControl != null && viewControl.PDFViewTool != null)
|
|
|
{
|
|
|
+ CPDFViewer pdfviewer=viewControl.PDFViewTool.GetCPDFViewer();
|
|
|
+ CPDFDocument pdfDoc=pdfviewer?.GetDocument();
|
|
|
+ if(pdfDoc==null)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
try
|
|
|
{
|
|
|
- CPDFDocument pdfDoc = pdfViewer.PDFView.Document;
|
|
|
if (pdfDoc.WriteToLoadedPath())
|
|
|
{
|
|
|
return;
|
|
@@ -722,14 +742,28 @@ namespace PDFViewer
|
|
|
|
|
|
private void CommandBinding_Executed_ScaleAdd(object sender, ExecutedRoutedEventArgs e)
|
|
|
{
|
|
|
- double newZoom = CheckZoomLevel(pdfViewer.PDFView.ZoomFactor + 0.01, true);
|
|
|
- pdfViewer.PDFView?.Zoom(newZoom);
|
|
|
+ if (viewControl != null && viewControl.PDFViewTool != null)
|
|
|
+ {
|
|
|
+ CPDFViewer pdfViewer = viewControl.PDFViewTool.GetCPDFViewer();
|
|
|
+ if (pdfViewer != null)
|
|
|
+ {
|
|
|
+ double newZoom = CheckZoomLevel(pdfViewer.GetZoom() + 0.01, true);
|
|
|
+ pdfViewer.SetZoom(newZoom);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void CommandBinding_Executed_ScaleSubtract(object sender, ExecutedRoutedEventArgs e)
|
|
|
{
|
|
|
- double newZoom = CheckZoomLevel(pdfViewer.PDFView.ZoomFactor - 0.01, false);
|
|
|
- pdfViewer.PDFView?.Zoom(newZoom);
|
|
|
+ if(viewControl!=null && viewControl.PDFViewTool!=null)
|
|
|
+ {
|
|
|
+ CPDFViewer pdfViewer= viewControl.PDFViewTool.GetCPDFViewer();
|
|
|
+ if(pdfViewer!=null)
|
|
|
+ {
|
|
|
+ double newZoom = CheckZoomLevel(pdfViewer.GetZoom() - 0.01, false);
|
|
|
+ pdfViewer.SetZoom(newZoom);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void CommandBinding_Executed_DisplaySettings(object sender, ExecutedRoutedEventArgs e)
|
|
@@ -743,7 +777,7 @@ namespace PDFViewer
|
|
|
{
|
|
|
PasswordUI.Visibility = Visibility.Collapsed;
|
|
|
FileInfoControl.Visibility = Visibility.Visible;
|
|
|
- FileInfoControl.InitWithPDFViewer(pdfViewer.PDFView);
|
|
|
+ FileInfoControl.InitWithPDFViewer(viewControl);
|
|
|
FileInfoControl.CloseInfoEvent -= CPDFInfoControl_CloseInfoEvent;
|
|
|
FileInfoControl.CloseInfoEvent += CPDFInfoControl_CloseInfoEvent;
|
|
|
PopupBorder.Visibility = Visibility.Visible;
|