|
@@ -22,13 +22,16 @@ using static Dropbox.Api.Files.FileCategory;
|
|
|
using PDF_Office.Views.PropertyPanel.AnnotPanel;
|
|
|
using System.Windows.Controls;
|
|
|
using PDF_Office.CustomControl;
|
|
|
+using System.Windows.Markup;
|
|
|
+using ComPDFKitViewer;
|
|
|
+using System.Runtime.InteropServices;
|
|
|
|
|
|
namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
{
|
|
|
internal class LinkAnnotPropertyViewModel : BindableBase, INavigationAware
|
|
|
{
|
|
|
public AnnotAttribEvent AnnotAttribEvent { get; set; }
|
|
|
- private int totalPage = 0;
|
|
|
+
|
|
|
private AnnotPropertyPanel PropertyPanel;
|
|
|
private AnnotArgsType annotType;
|
|
|
|
|
@@ -64,12 +67,35 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private string pageNumTextContent = "Enter target page";
|
|
|
+ private string pageNumTextContent;
|
|
|
|
|
|
public string PageNumTextContent
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
+ //if (string.IsNullOrEmpty(pageNumTextContent))
|
|
|
+ //{
|
|
|
+ // return "Enter target page";
|
|
|
+ //}
|
|
|
+ //if (pageNumTextContent != "Enter target page")
|
|
|
+ //{
|
|
|
+ if (CheckPageNumVaild(out int pageNum, pageNumTextContent))
|
|
|
+ {
|
|
|
+ if (AnnotArgs != null)
|
|
|
+ {
|
|
|
+ AnnotArgs.DestIndex = pageNum - 1;
|
|
|
+ //BtnLocationIsEnabled = true;
|
|
|
+ SetImagePreview(AnnotArgs.DestIndex);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //BtnLocationIsEnabled = false;
|
|
|
+ ImagePreviewVisibility = Visibility.Collapsed;
|
|
|
+ BtnGOorBackVisibility = Visibility.Collapsed;
|
|
|
+ }
|
|
|
+ //}
|
|
|
+
|
|
|
return pageNumTextContent;
|
|
|
}
|
|
|
set
|
|
@@ -78,6 +104,70 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 设置预文本内容
|
|
|
+ /// </summary>
|
|
|
+ private string pageNumPlaceHoldText = "Enter target page";
|
|
|
+
|
|
|
+ public string PageNumPlaceHoldText
|
|
|
+ {
|
|
|
+ get { return pageNumPlaceHoldText; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref pageNumPlaceHoldText, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 是否显示输入框下方提示文案
|
|
|
+ /// </summary>
|
|
|
+ private Visibility showPageNumTip = Visibility.Collapsed;
|
|
|
+
|
|
|
+ public Visibility ShowPageNumTip
|
|
|
+ {
|
|
|
+ get { return showPageNumTip; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref showPageNumTip, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 输入框下方提示文案
|
|
|
+ /// </summary>
|
|
|
+ private string pageNumTipText = "Page number error.";
|
|
|
+
|
|
|
+ public string PageNumTipText
|
|
|
+ {
|
|
|
+ get { return pageNumTipText; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref pageNumTipText, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool pageNumTextIsEnabled = false;
|
|
|
+
|
|
|
+ public bool PageNumTextIsEnabled
|
|
|
+ {
|
|
|
+ get { return pageNumTextIsEnabled; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref pageNumTextIsEnabled, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool btnLocationIsEnabled = false;
|
|
|
+
|
|
|
+ public bool BtnLocationIsEnabled
|
|
|
+ {
|
|
|
+ get { return btnLocationIsEnabled; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref btnLocationIsEnabled, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private WriteableBitmap previewImage;
|
|
|
|
|
|
public WriteableBitmap PreviewImage
|
|
@@ -89,6 +179,28 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private int imagePreviewWidth = 196;
|
|
|
+
|
|
|
+ public int ImagePreviewWidth
|
|
|
+ {
|
|
|
+ get { return imagePreviewWidth; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref imagePreviewWidth, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private int imagePreviewHeight = 256;
|
|
|
+
|
|
|
+ public int ImagePreviewHeight
|
|
|
+ {
|
|
|
+ get { return imagePreviewHeight; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref imagePreviewHeight, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private Visibility imagePreviewVisibility = Visibility.Collapsed;
|
|
|
|
|
|
public Visibility ImagePreviewVisibility
|
|
@@ -111,87 +223,209 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private Visibility errorNumTipsVisibility = Visibility.Collapsed;
|
|
|
+ private string btnGOorBackContent = "GO";
|
|
|
+
|
|
|
+ public string BtnGOorBackContent
|
|
|
+ {
|
|
|
+ get { return btnGOorBackContent; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref btnGOorBackContent, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool btnLinkPageIsChecked = true;
|
|
|
+
|
|
|
+ public bool BtnLinkPageIsChecked
|
|
|
+ {
|
|
|
+ get { return btnLinkPageIsChecked; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref btnLinkPageIsChecked, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool btnLinkWebIsChecked = false;
|
|
|
|
|
|
- public Visibility ErrorNumTipsVisibility
|
|
|
+ public bool BtnLinkWebIsChecked
|
|
|
{
|
|
|
- get { return errorNumTipsVisibility; }
|
|
|
+ get { return btnLinkWebIsChecked; }
|
|
|
set
|
|
|
{
|
|
|
- SetProperty(ref errorNumTipsVisibility, value);
|
|
|
+ SetProperty(ref btnLinkWebIsChecked, value);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private Visibility errorRangeTipsVisibility = Visibility.Collapsed;
|
|
|
+ private bool btnLinkMailIsChecked = false;
|
|
|
|
|
|
- public Visibility ErrorRangeTipsVisibility
|
|
|
+ public bool BtnLinkMailIsChecked
|
|
|
{
|
|
|
- get { return errorRangeTipsVisibility; }
|
|
|
+ get { return btnLinkMailIsChecked; }
|
|
|
set
|
|
|
{
|
|
|
- SetProperty(ref errorRangeTipsVisibility, value);
|
|
|
+ SetProperty(ref btnLinkMailIsChecked, value);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //private Visibility errorNumTipsVisibility = Visibility.Collapsed;
|
|
|
+
|
|
|
+ //public Visibility ErrorNumTipsVisibility
|
|
|
+ //{
|
|
|
+ // get { return errorNumTipsVisibility; }
|
|
|
+ // set
|
|
|
+ // {
|
|
|
+ // SetProperty(ref errorNumTipsVisibility, value);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+
|
|
|
+ //private Visibility errorRangeTipsVisibility = Visibility.Collapsed;
|
|
|
+
|
|
|
+ //public Visibility ErrorRangeTipsVisibility
|
|
|
+ //{
|
|
|
+ // get { return errorRangeTipsVisibility; }
|
|
|
+ // set
|
|
|
+ // {
|
|
|
+ // SetProperty(ref errorRangeTipsVisibility, value);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ private int totalPage = 0;
|
|
|
+
|
|
|
+ private bool isLoaded = false;
|
|
|
+ private int historyPageIndex = 0;
|
|
|
+ private int backPageIndex = 0;
|
|
|
private CPDFViewer pdfViewer;
|
|
|
private CPDFDocument document;
|
|
|
private LinkAnnotProperty linkAnnot;
|
|
|
public DelegateCommand<object> LoadedCommand { get; set; }
|
|
|
public DelegateCommand<object> PageNumTextChangedCommand { get; set; }
|
|
|
+ public DelegateCommand<object> BtnGOorBackPageCommand { get; set; }
|
|
|
+ public DelegateCommand<object> LocationCommand { get; set; }
|
|
|
+
|
|
|
//public DelegateCommand<object> ToggleButtonTabCommand { get; set; }
|
|
|
|
|
|
public LinkAnnotPropertyViewModel()
|
|
|
{
|
|
|
LoadedCommand = new DelegateCommand<object>(Loaded);
|
|
|
PageNumTextChangedCommand = new DelegateCommand<object>(PageNumTextChanged);
|
|
|
+ BtnGOorBackPageCommand = new DelegateCommand<object>(BtnGOorBackPageEvent);
|
|
|
+ LocationCommand = new DelegateCommand<object>(LocationPage);
|
|
|
//ToggleButtonTabCommand = new DelegateCommand<object>(ToggleButtonTabSelected);
|
|
|
+ isLoaded = true;
|
|
|
}
|
|
|
|
|
|
- //private void ToggleButtonTabSelected(object obj)
|
|
|
- //{
|
|
|
- // if (obj is object[] array)
|
|
|
- // {
|
|
|
- // }
|
|
|
- //}
|
|
|
+ private void LocationPage(object obj)
|
|
|
+ {
|
|
|
+ if (!string.IsNullOrEmpty(PageNumTextContent))
|
|
|
+ {
|
|
|
+ AnnotAttribEvent?.UpdateAttrib(AnnotAttrib.LinkType, LINK_TYPE.GOTO);
|
|
|
+ AnnotAttribEvent?.UpdateAttrib(AnnotAttrib.LinkDestIndx, Convert.ToInt32(PageNumTextContent) - 1);
|
|
|
+ AnnotAttribEvent?.UpdateAnnot();
|
|
|
|
|
|
- private void PageNumTextChanged(object obj)
|
|
|
+ if (AnnotArgs != null)
|
|
|
+ {
|
|
|
+ AnnotArgs.InvokeLinkSaveCalled(this, EventArgs.Empty);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void BtnGOorBackPageEvent(object obj)
|
|
|
{
|
|
|
- if (obj is TextChangedEventArgs textChangedEventArgs)
|
|
|
+ if (obj is object[] arry)
|
|
|
{
|
|
|
- if (textChangedEventArgs.Source is TextBoxWithTip textBox)
|
|
|
+ Button btnGOorBack = arry[0] as Button;
|
|
|
+ RadioButton btnLinkPage = arry[1] as RadioButton;
|
|
|
+ RadioButton btnLinkWeb = arry[2] as RadioButton;
|
|
|
+ RadioButton btnLinkMail = arry[3] as RadioButton;
|
|
|
+
|
|
|
+ if (btnLinkPage != null && btnGOorBack != null && btnLinkWeb != null && btnLinkMail != null)
|
|
|
{
|
|
|
- int pageNum = -1;
|
|
|
- if (CheckPageNumVaild(out pageNum, textBox))
|
|
|
+ if (btnLinkPage.IsChecked == true)
|
|
|
{
|
|
|
- if (AnnotArgs != null)
|
|
|
+ int pageIndex = Convert.ToInt32(PageNumTextContent) - 1;
|
|
|
+ if (btnGOorBack.Tag.ToString() == "GO")
|
|
|
+ {
|
|
|
+ if (AnnotArgs != null)
|
|
|
+ {
|
|
|
+ historyPageIndex = AnnotArgs.PageIndex;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ historyPageIndex = backPageIndex;
|
|
|
+ }
|
|
|
+ pdfViewer.GoToPage(pageIndex);
|
|
|
+
|
|
|
+ ChangeBtnGOorBack("BACK", btnGOorBack);
|
|
|
+ SetImagePreview(historyPageIndex);
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- AnnotArgs.DestIndex = pageNum - 1;
|
|
|
- SetImagePreview();
|
|
|
+ pdfViewer.GoToPage(historyPageIndex);
|
|
|
+ ChangeBtnGOorBack("GO", btnGOorBack);
|
|
|
+ SetImagePreview(pageIndex);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private bool CheckPageNumVaild(out int pageNum, TextBoxWithTip textBox)
|
|
|
+ private void ChangeBtnGOorBack(string flag, Button button)
|
|
|
+ {
|
|
|
+ switch (flag)
|
|
|
+ {
|
|
|
+ case "BACK":
|
|
|
+ button.Tag = "BACK";
|
|
|
+ button.Content = "BACK";
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "GO":
|
|
|
+ button.Tag = "GO";
|
|
|
+ button.Content = "GO";
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void PageNumTextChanged(object obj)
|
|
|
+ {
|
|
|
+ if (obj is TextChangedEventArgs textChangedEventArgs)
|
|
|
+ {
|
|
|
+ if (textChangedEventArgs.Source is TextBoxWithTip textBox)
|
|
|
+ {
|
|
|
+ int pageNum = -1;
|
|
|
+ //if (CheckPageNumVaild(out pageNum))
|
|
|
+ //{
|
|
|
+ // if (AnnotArgs != null)
|
|
|
+ // {
|
|
|
+ // AnnotArgs.DestIndex = pageNum - 1;
|
|
|
+ // SetImagePreview();
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool CheckPageNumVaild(out int pageNum, string text)
|
|
|
{
|
|
|
pageNum = -1;
|
|
|
- ErrorNumTipsVisibility = Visibility.Collapsed;
|
|
|
- ErrorRangeTipsVisibility = Visibility.Collapsed;
|
|
|
- BtnGOorBackVisibility = Visibility.Collapsed;
|
|
|
- if (string.IsNullOrEmpty(textBox.Text))
|
|
|
+ //ErrorNumTipsVisibility = Visibility.Collapsed;
|
|
|
+ //ErrorRangeTipsVisibility = Visibility.Collapsed;
|
|
|
+ //BtnGOorBackVisibility = Visibility.Collapsed;
|
|
|
+ if (string.IsNullOrEmpty(text))
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
- if (textBox.Text.Trim() != string.Empty)
|
|
|
+ if (text.Trim() != string.Empty)
|
|
|
{
|
|
|
- if (!int.TryParse(textBox.Text.Trim(), out pageNum))
|
|
|
+ if (!int.TryParse(text.Trim(), out pageNum))
|
|
|
{
|
|
|
//ErrorNumTipsVisibility = Visibility.Visible;
|
|
|
//ErrorRangeTipsVisibility = Visibility.Collapsed;
|
|
|
- textBox.IsError = true;
|
|
|
- textBox.ShowTip = Visibility.Visible;
|
|
|
- textBox.TipText = " Page number error.";
|
|
|
+ //textBox.IsError = true;
|
|
|
+ //PageNumTextIsError = true;
|
|
|
+ ShowPageNumTip = Visibility.Visible;
|
|
|
+ PageNumTipText = " Page number error.";
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -199,33 +433,35 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
{
|
|
|
//ErrorNumTipsVisibility = Visibility.Collapsed;
|
|
|
//ErrorRangeTipsVisibility = Visibility.Visible;
|
|
|
- textBox.IsError = true;
|
|
|
- textBox.ShowTip = Visibility.Visible;
|
|
|
- textBox.TipText = " Page number out of range.";
|
|
|
+ //textBox.IsError = true;
|
|
|
+ //PageNumTextIsError = true;
|
|
|
+ ShowPageNumTip = Visibility.Visible;
|
|
|
+ PageNumTipText = " Page number out of range.";
|
|
|
return false;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- textBox.IsError = false;
|
|
|
- textBox.ShowTip = Visibility.Collapsed;
|
|
|
+ //textBox.IsError = false;
|
|
|
+ //PageNumTextIsError = false;
|
|
|
+ ShowPageNumTip = Visibility.Collapsed;
|
|
|
}
|
|
|
BtnGOorBackVisibility = Visibility.Visible;
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- private void SetImagePreview()
|
|
|
+ private void SetImagePreview(int pageIndex)
|
|
|
{
|
|
|
ImagePreviewVisibility = Visibility.Visible;
|
|
|
BtnGOorBackVisibility = Visibility.Visible;
|
|
|
|
|
|
- int dpiHeight = (int)linkAnnot.ImagePreview.Height;
|
|
|
- int dpiWidth = (int)linkAnnot.ImagePreview.Width;
|
|
|
+ int dpiHeight = (int)ImagePreviewHeight;
|
|
|
+ int dpiWidth = (int)ImagePreviewWidth;
|
|
|
if (dpiHeight <= 0 || dpiWidth <= 0)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- int pageIndex = AnnotArgs.DestIndex;
|
|
|
+ //int pageIndex = AnnotArgs.DestIndex;
|
|
|
Rect MediaRect = GetPageRect(document, pageIndex, CPDFDisplayBox.MediaBox);
|
|
|
|
|
|
System.Windows.Size pageSize = GetPageSize(document, pageIndex);
|
|
@@ -245,7 +481,8 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
|
|
|
private void _annotArgs_LinkDrawFinished(object sender, bool e)
|
|
|
{
|
|
|
- linkAnnot.SetTextBoxEnableOrNot(e, totalPage);
|
|
|
+ //linkAnnot.SetTextBoxEnableOrNot(e, totalPage);
|
|
|
+ SetTextBoxEnableOrNot(e, totalPage);
|
|
|
//AnnotArgs = (LinkAnnotArgs)PropertyPanel.annot;
|
|
|
}
|
|
|
|
|
@@ -282,7 +519,27 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
|
|
|
document = pdfViewer.Document;
|
|
|
totalPage = pdfViewer.Document.PageCount;
|
|
|
- if (linkAnnot != null)
|
|
|
+
|
|
|
+ SetTextBoxEnableOrNot(false, totalPage);
|
|
|
+
|
|
|
+ if (AnnotAttribEvent.Attribs.ContainsKey(AnnotAttrib.LinkType))
|
|
|
+ {
|
|
|
+ SetLinkType((LINK_TYPE)AnnotAttribEvent.Attribs[AnnotAttrib.LinkType]);
|
|
|
+ }
|
|
|
+ if (AnnotAttribEvent.Attribs.ContainsKey(AnnotAttrib.LinkDestIndx) && !AnnotAttribEvent.IsAnnotCreateReset)
|
|
|
+ {
|
|
|
+ SetLinkPageNum((int)AnnotAttribEvent.Attribs[AnnotAttrib.LinkDestIndx] + 1);
|
|
|
+ if (AnnotArgs == null)
|
|
|
+ {
|
|
|
+ backPageIndex = pdfViewer.CurrentIndex;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ AnnotArgs.PageIndex = pdfViewer.CurrentIndex;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isLoaded)
|
|
|
{
|
|
|
if (pdfViewer != null && pdfViewer.ToolManager != null && pdfViewer.ToolManager.CurrentAnnotArgs?.EventType == AnnotArgsType.AnnotLink)
|
|
|
{
|
|
@@ -291,15 +548,88 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
AnnotArgs = pdfViewer.ToolManager.CurrentAnnotArgs as LinkAnnotArgs;
|
|
|
}
|
|
|
}
|
|
|
- linkAnnot.SetTextBoxEnableOrNot(!AnnotAttribEvent.IsAnnotCreateReset, totalPage);
|
|
|
}
|
|
|
- else
|
|
|
+ if (AnnotArgs == null)
|
|
|
{
|
|
|
AnnotArgs = (LinkAnnotArgs)PropertyPanel.annot;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void SetLinkPageNum(int pageNum)
|
|
|
+ {
|
|
|
+ if (pageNum > 0 && pageNum <= totalPage)
|
|
|
+ {
|
|
|
+ PageNumTextContent = pageNum.ToString();
|
|
|
+ BtnLocationIsEnabled = true;
|
|
|
+ PageNumTextIsEnabled = true;
|
|
|
+ ImagePreviewVisibility = Visibility.Visible;
|
|
|
+ SetImagePreview(pageNum - 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void SetLinkType(LINK_TYPE linkType, bool isMail = false)
|
|
|
+ {
|
|
|
+ BtnLinkPageIsChecked = false;
|
|
|
+ BtnLinkMailIsChecked = false;
|
|
|
+ BtnLinkWebIsChecked = false;
|
|
|
+ switch (linkType)
|
|
|
+ {
|
|
|
+ case LINK_TYPE.GOTO:
|
|
|
+ BtnLinkPageIsChecked = true;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case LINK_TYPE.URI:
|
|
|
+ if (isMail)
|
|
|
+ {
|
|
|
+ BtnLinkMailIsChecked = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ BtnLinkWebIsChecked = true;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ BtnLinkPageIsChecked = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void SetTextBoxEnableOrNot(bool enable, int totalPage)
|
|
|
+ {
|
|
|
+ this.totalPage = totalPage;
|
|
|
+
|
|
|
+ PageNumTextContent = string.Empty;
|
|
|
+ //PageWebText.Text = string.Empty;
|
|
|
+ //PageMailText.Text = string.Empty;
|
|
|
+
|
|
|
+ PageNumTextIsEnabled = enable;
|
|
|
+ if (PageNumTextIsEnabled == true)
|
|
|
+ {
|
|
|
+ //defaultPageNumText.Text = string.Format($"1-{totalPage}页");
|
|
|
+ //PageNumText.PlaceholderText = string.Format($"1-{totalPage}页");
|
|
|
+ PageNumPlaceHoldText = string.Format($"1-{totalPage}页");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //defaultPageNumText.Text = "Enter target page";
|
|
|
+ //PageNumText.PlaceholderText = "Enter target page";
|
|
|
+ PageNumPlaceHoldText = "Enter target page";
|
|
|
+ }
|
|
|
+ ShowPageNumTip = Visibility.Collapsed;
|
|
|
+ //BorderPageNumText.Background = enable ? Brushes.White : Brushes.LightGray;
|
|
|
+
|
|
|
+ //PageWebText.IsEnabled = enable;
|
|
|
+ //BorderPageWebText.Background = enable ? Brushes.White : Brushes.LightGray;
|
|
|
+
|
|
|
+ //PageMailText.IsEnabled = enable;
|
|
|
+ //BorderPageMailText.Background = enable ? Brushes.White : Brushes.LightGray;
|
|
|
+
|
|
|
+ BtnLocationIsEnabled = enable;
|
|
|
+ //BtnGOorBack.IsEnabled = false;
|
|
|
+ }
|
|
|
+
|
|
|
public byte[] RenderPDFPageToArray(CPDFDocument document, int pageIndex, Rect renderRect, double currentZoom, bool renderAnnot = false, bool renderForm = false)
|
|
|
{
|
|
|
if (renderRect.Width <= 0 || renderRect.Height <= 0 || document == null)
|