|
@@ -15,6 +15,8 @@ using System.IO;
|
|
using System.Linq;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Threading.Tasks;
|
|
|
|
+using System.Windows;
|
|
|
|
+using System.Windows.Ink;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Media.Imaging;
|
|
|
|
|
|
namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
@@ -50,7 +52,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
case SignatureType.Drawing:
|
|
case SignatureType.Drawing:
|
|
{
|
|
{
|
|
StampAnnotArgs stampArgs = new StampAnnotArgs();
|
|
StampAnnotArgs stampArgs = new StampAnnotArgs();
|
|
- stampArgs.SetInkData(tuple.Item2, signature.DrawingAttributesObject.Width, signature.DrawingAttributesObject.Color);
|
|
|
|
|
|
+ stampArgs.SetInkData(GetPoints(signature.DrawingPath), signature.DrawingAttributesObject.Width, signature.DrawingAttributesObject.Color);
|
|
PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
|
|
PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
|
|
PDFViewer.SetToolParam(stampArgs);
|
|
PDFViewer.SetToolParam(stampArgs);
|
|
}
|
|
}
|
|
@@ -59,6 +61,30 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ private List<List<Point>> GetPoints(string Path)
|
|
|
|
+ {
|
|
|
|
+ StrokeCollection Strokes;
|
|
|
|
+ List<List<Point>> RawPointList = new List<List<Point>>();
|
|
|
|
+ using (FileStream strokeStream = File.OpenRead(Path))
|
|
|
|
+ {
|
|
|
|
+ Strokes = new StrokeCollection(strokeStream);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (int kk = 0; kk < Strokes.Count; kk++)
|
|
|
|
+ {
|
|
|
|
+ List<Point> p = new List<Point>();
|
|
|
|
+ RawPointList.Add(p);
|
|
|
|
+ for (int gg = 0; gg < Strokes[kk].StylusPoints.Count; gg++)
|
|
|
|
+ {
|
|
|
|
+ var point = Strokes[kk].StylusPoints[gg].ToPoint();
|
|
|
|
+
|
|
|
|
+ if (point.X >= 0 && point.Y >= 0)
|
|
|
|
+ RawPointList[kk].Add(point);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return RawPointList;
|
|
|
|
+ }
|
|
private void ShowDialog()
|
|
private void ShowDialog()
|
|
{
|
|
{
|
|
bool result = true;
|
|
bool result = true;
|
|
@@ -101,6 +127,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
{
|
|
{
|
|
Signature.SourcePath = viewModel.SaveToPath;
|
|
Signature.SourcePath = viewModel.SaveToPath;
|
|
}
|
|
}
|
|
|
|
+ Signature.DrawingPath = viewModel.DrawingSaveToPath;
|
|
Signature.Type = (SignatureType)viewModel.TabItemIndex;
|
|
Signature.Type = (SignatureType)viewModel.TabItemIndex;
|
|
Signature.DrawingAttributesObject = viewModel.DrawingAttributeObject;
|
|
Signature.DrawingAttributesObject = viewModel.DrawingAttributeObject;
|
|
SignatureList.Add(Signature);
|
|
SignatureList.Add(Signature);
|
|
@@ -156,6 +183,11 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
{
|
|
{
|
|
int index = SignatureList.IndexOf(Item);
|
|
int index = SignatureList.IndexOf(Item);
|
|
App.CachePath.AddToDeleteFiles(Item.SourcePath);
|
|
App.CachePath.AddToDeleteFiles(Item.SourcePath);
|
|
|
|
+ if (!string.IsNullOrEmpty(Item.DrawingPath))
|
|
|
|
+ {
|
|
|
|
+ App.CachePath.AddToDeleteFiles(Item.DrawingPath);
|
|
|
|
+
|
|
|
|
+ }
|
|
SignatureList.RemoveAt(index);
|
|
SignatureList.RemoveAt(index);
|
|
}
|
|
}
|
|
public void DeleteAll()
|
|
public void DeleteAll()
|
|
@@ -163,6 +195,12 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
foreach (Signature item in SignatureList)
|
|
foreach (Signature item in SignatureList)
|
|
{
|
|
{
|
|
App.CachePath.AddToDeleteFiles(item.SourcePath);
|
|
App.CachePath.AddToDeleteFiles(item.SourcePath);
|
|
|
|
+
|
|
|
|
+ if (!string.IsNullOrEmpty(item.DrawingPath))
|
|
|
|
+ {
|
|
|
|
+ App.CachePath.AddToDeleteFiles(item.DrawingPath);
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
SignatureList.Clear();
|
|
SignatureList.Clear();
|
|
}
|
|
}
|