Преглед на файлове

ComPDFKit.Tool(pdftech) - FreeText创建修改

liyuxuan преди 8 месеца
родител
ревизия
ddf799c6ea

BIN
Demo/Examples/ComPDFKit.Tool/ComPDFKit.NET.dll


+ 8 - 0
Demo/Examples/ComPDFKit.Tool/ComPDFKit.Tool.csproj

@@ -81,6 +81,14 @@
     <LangVersion>7.3</LangVersion>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="ComPDFKit.NET, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>.\ComPDFKit.NET.dll</HintPath>
+    </Reference>
+    <Reference Include="ComPDFKit.Viewer, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>.\ComPDFKit.Viewer.dll</HintPath>
+    </Reference>
     <Reference Include="PresentationCore" />
     <Reference Include="PresentationFramework" />
     <Reference Include="System" />

BIN
Demo/Examples/ComPDFKit.Tool/ComPDFKit.Viewer.dll


+ 19 - 6
Demo/Examples/ComPDFKit.Tool/DrawTool/CreateAnnotTool.cs

@@ -1454,7 +1454,7 @@ namespace ComPDFKit.Tool.DrawTool
 
                     Border textBorder = new Border();
                     textBorder.Child = textui;
-                    textui.Width = 200;
+                   
                     CTextAttribute textAttribute = annotFreeText.FreeTextDa;
                     byte transparency = annotFreeText.GetTransparency();
                     textui.FontSize = DpiHelper.PDFNumToStandardNum(textAttribute.FontSize * zoomFactor);
@@ -1476,15 +1476,28 @@ namespace ComPDFKit.Tool.DrawTool
                     {
                         backgroundColor = Color.FromRgb(annotFreeText.BgColor[0], annotFreeText.BgColor[1], annotFreeText.BgColor[2]);
                     }
-                    Point MousePoint = new Point((mouseStartPoint.X - pageBound.X), (mouseStartPoint.Y - pageBound.Y));
-                    textBorder.MaxWidth = (pageBound.Width - MousePoint.X - cropPoint.X);
-                    textBorder.MaxHeight = (pageBound.Height - MousePoint.Y - cropPoint.Y);
 
+                    Point MousePoint = new Point((mouseStartPoint.X - pageBound.X), (mouseStartPoint.Y - pageBound.Y));
                     textui.Foreground = new SolidColorBrush(textColor);
                     textui.Background = new SolidColorBrush(backgroundColor);
+
+                    textBorder.MaxWidth =(pageBound.Width - MousePoint.X - cropPoint.X);
+                    textBorder.MaxHeight =(pageBound.Height - MousePoint.Y - cropPoint.Y);
                     textui.MinHeight = 40;
                     textui.MinWidth = 200;
 
+                    if(string.IsNullOrEmpty(annotFreeText.Content)==false)
+                    {
+                        textBorder.MaxWidth = Math.Max(200, (pageBound.Width - MousePoint.X - cropPoint.X));
+                        textBorder.MaxHeight = Math.Max(40, (pageBound.Height - MousePoint.Y - cropPoint.Y));
+                        textBorder.MinWidth = 200;
+                        textBorder.MinHeight = 40;
+                    }
+                    else
+                    {
+                        textui.Width = 150;
+                    }
+
                     textBorder.Padding = new Thickness(0);
                     textBorder.BorderBrush = new SolidColorBrush(borderColor);
                     textBorder.BorderThickness = new Thickness(DpiHelper.PDFNumToStandardNum(annotFreeText.GetBorderWidth() * zoomFactor));
@@ -1493,7 +1506,7 @@ namespace ComPDFKit.Tool.DrawTool
 
                     string fontName = string.Empty;
                     string fontFamily = string.Empty;
-                    CPDFFont.GetFamlyStyleName(annotFreeText.FreeTextDa.FontName, ref fontFamily, ref fontName);
+                    CPDFFont.GetFamilyStyleName(annotFreeText.FreeTextDa.FontName, ref fontFamily, ref fontName);
                     textui.FontFamily = new FontFamily(fontFamily);
 
                     textui.AcceptsReturn = true;
@@ -1722,7 +1735,7 @@ namespace ComPDFKit.Tool.DrawTool
 
                     string fontName = string.Empty;
                     string fontFamily = string.Empty;
-                    CPDFFont.GetFamlyStyleName(annotFreeText.FreeTextDa.FontName, ref fontFamily, ref fontName);
+                    CPDFFont.GetFamilyStyleName(annotFreeText.FreeTextDa.FontName, ref fontFamily, ref fontName);
                     lastTextui.FontFamily = new FontFamily(fontFamily);
 
                     lastTextui.FontWeight = IsBold(textAttribute.FontName) ? FontWeights.Bold : FontWeights.Normal;

+ 1 - 1
Demo/Examples/ComPDFKit.Tool/Help/ParamConverter.cs

@@ -347,7 +347,7 @@ namespace ComPDFKit.Tool.Help
             bool isBold = false;
             bool isItalic = false;
 
-            cPDFEditArea.GetTextStyle(ref fontSize, ref fontColor, ref transparency, ref isBold, ref isItalic);
+            cPDFEditArea.GetTextStyle(ref fontName, ref fontSize, ref fontColor, ref transparency, ref isBold, ref isItalic);
             textEditParam.FontName = fontName;
             textEditParam.FontSize = fontSize;
             textEditParam.FontColor = fontColor;