개정판 af0bcefa
Fix: (Final Service) TextControl 회전 오류 수정(TextControl과 ArrowTextControl의 회전 로직이 달라 함수 분리)
Change-Id: Ieb3b0a13b557f964a7ca66209678dce9ebd2701f
FinalService/KCOM_FinalService/MarkupToPDF/Controls/Common/MathSet.cs | ||
---|---|---|
317 | 317 |
|
318 | 318 |
return res; |
319 | 319 |
} |
320 |
|
|
320 | 321 |
/// <summary> |
321 | 322 |
/// return normal vector from p1 to p2 |
322 | 323 |
/// </summary> |
... | ... | |
431 | 432 |
} |
432 | 433 |
|
433 | 434 |
/// <summary> |
434 |
|
|
435 | 435 |
/// 최단거리 구하기 |
436 |
|
|
437 | 436 |
/// </summary> |
438 |
|
|
439 | 437 |
/// <param name="point">포인트</param> |
440 |
|
|
441 | 438 |
/// <param name="listStartPoint">직선 시작 포인트</param> |
442 |
|
|
443 | 439 |
/// <param name="lineEndPoint">직선 종료 포인트</param> |
444 |
|
|
445 | 440 |
/// <param name="closestPoint">최근접 포인트</param> |
446 |
|
|
447 | 441 |
/// <returns>최단거리</returns> |
448 |
|
|
449 | 442 |
public static double GetShortestDistance(Point point, Point listStartPoint, Point lineEndPoint, out Point closestPoint) |
450 | 443 |
{ |
451 | 444 |
double dx = lineEndPoint.X - listStartPoint.X; |
... | ... | |
491 | 484 |
} |
492 | 485 |
|
493 | 486 |
return Math.Sqrt(dx * dx + dy * dy); |
494 |
|
|
495 | 487 |
} |
496 |
|
|
497 |
|
|
498 | 488 |
} |
499 | 489 |
} |
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/DrawSet_Arc.cs | ||
---|---|---|
26 | 26 |
contentByte.SetLineWidth((float)lineSize); |
27 | 27 |
contentByte.NewPath(); |
28 | 28 |
|
29 |
|
|
30 | 29 |
contentByte.MoveTo((float)p1.X, (float)p1.Y); |
31 | 30 |
|
32 | 31 |
if (p2.Y >= p1.Y || p2.Y >= p3.Y) //중간 Mid Point 는 Curve 특성에 대한 10 범위 내의 오차 적용 |
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/DrawSet_DrawString.cs | ||
---|---|---|
249 | 249 |
} |
250 | 250 |
} |
251 | 251 |
|
252 |
private static void PaintFill(PdfContentByte contentByte, PaintSet PaintStyle, BaseColor bs)
|
|
252 |
public static void PaintFill(PdfContentByte contentByte, PaintSet PaintStyle, BaseColor bs)
|
|
253 | 253 |
{ |
254 | 254 |
if ((PaintStyle & PaintSet.Highlight) == PaintSet.Highlight) |
255 | 255 |
{ |
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/DrawSet_Image.cs | ||
---|---|---|
57 | 57 |
contentByte.RestoreState(); |
58 | 58 |
} |
59 | 59 |
|
60 |
/// <summary> |
|
61 |
/// Sign을 그린다. |
|
62 |
/// </summary> |
|
63 |
/// <param name="startPoint"></param> |
|
64 |
/// <param name="endPoint"></param> |
|
65 |
/// <param name="pointSet"></param> |
|
66 |
/// <param name="contentByte"></param> |
|
67 |
/// <param name="UserID"></param> |
|
68 |
/// <param name="Angle"></param> |
|
69 |
/// <param name="opac"></param> |
|
70 |
/// <param name="projectNo"></param> |
|
60 | 71 |
public static void DrawSign(System.Windows.Point startPoint, System.Windows.Point endPoint, List<System.Windows.Point> pointSet, PdfContentByte contentByte, string UserID, double Angle, double opac, string projectNo) |
61 | 72 |
{ |
62 | 73 |
contentByte.SaveState(); |
... | ... | |
85 | 96 |
using (System.IO.MemoryStream ms = new System.IO.MemoryStream(imageBytes)) |
86 | 97 |
{ |
87 | 98 |
var midP = MathSet.getMiddlePoint(startPoint, endPoint); |
99 |
|
|
88 | 100 |
List<System.Windows.Point> tempPoint = new List<System.Windows.Point>(); |
89 | 101 |
foreach (var item in pointSet) |
90 | 102 |
{ |
... | ... | |
143 | 155 |
contentByte.RestoreState(); |
144 | 156 |
} |
145 | 157 |
|
158 |
/// <summary> |
|
159 |
/// url의 이미지를 가져온다. |
|
160 |
/// </summary> |
|
161 |
/// <param name="uri"></param> |
|
162 |
/// <returns></returns> |
|
146 | 163 |
public static Image FromURI(string uri) |
147 | 164 |
{ |
148 | 165 |
Image image = null; |
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/DrawSet_Shape.cs | ||
---|---|---|
107 | 107 |
//contentByte.ClosePath(); |
108 | 108 |
} |
109 | 109 |
|
110 |
public static void DrawPolygon(List<System.Drawing.PointF> points, double lineSize, PdfContentByte contentByte, System.Windows.Media.DoubleCollection DashSize, |
|
111 |
System.Drawing.Color color, PaintSet PaintStyle, double opac) |
|
112 |
{ |
|
113 |
BaseColor bs = new BaseColor(color); |
|
114 |
contentByte.SaveState(); |
|
115 |
PdfGState gs1 = new PdfGState(); |
|
116 |
gs1.StrokeOpacity = (float)opac; |
|
117 |
gs1.FillOpacity = (float)opac; |
|
118 |
contentByte.SetGState(gs1); |
|
119 |
var rect = contentByte.PdfDocument.PageSize; |
|
120 |
contentByte.SetColorStroke(bs); |
|
121 |
if (DashSize.Count > 1) |
|
122 |
{ |
|
123 |
List<float> DashSet = new List<float>(); |
|
124 |
DashSize.ToList().ForEach(data => DashSet.Add((float)data * 1)); |
|
125 |
contentByte.SetLineDash(DashSet.ToArray(), DashSet.Count - 2); |
|
126 |
} |
|
127 |
|
|
128 |
contentByte.SetLineWidth((float)lineSize); |
|
129 |
|
|
130 |
contentByte.NewPath(); |
|
131 |
|
|
132 |
//사용은 가능하지만 연결성이 떨어짐 |
|
133 |
for (int i = 0; i < points.Count(); i++) |
|
134 |
{ |
|
135 |
if (i == 0) |
|
136 |
{ |
|
137 |
contentByte.MoveTo((float)points[i].X, (float)points[i].Y); |
|
138 |
} |
|
139 |
else |
|
140 |
{ |
|
141 |
contentByte.LineTo((float)points[i].X, (float)points[i].Y); |
|
142 |
} |
|
143 |
|
|
144 |
if (i == points.Count() - 1) |
|
145 |
{ |
|
146 |
contentByte.LineTo((float)points[i].X, (float)points[i].Y); |
|
147 |
|
|
148 |
if (points[i] != points[0]) |
|
149 |
{ |
|
150 |
contentByte.Stroke(); |
|
151 |
} |
|
152 |
|
|
153 |
} |
|
154 |
} |
|
155 |
|
|
156 |
|
|
157 |
DrawSet_Shape.PaintFill(contentByte, PaintStyle, bs, opac); |
|
158 |
contentByte.RestoreState(); |
|
159 |
//contentByte.ClosePath(); |
|
160 |
} |
|
161 |
|
|
110 | 162 |
public static void DrawTriangle(List<Point> points, double lineSize, PdfContentByte contentByte, System.Windows.Media.DoubleCollection DashSize, |
111 | 163 |
System.Drawing.Color color, PaintSet PaintStyle, double opac) |
112 | 164 |
{ |
FinalService/KCOM_FinalService/MarkupToPDF/MarkupToPDF.cs | ||
---|---|---|
122 | 122 |
return (size / scaleWidth); |
123 | 123 |
} |
124 | 124 |
|
125 |
public List<Point> GetPdfPointSystem(List<Point> point) |
|
125 |
public List<Point> GetPdfPointSystem(List<Point> points)
|
|
126 | 126 |
{ |
127 |
List<Point> dummy = new List<Point>(); |
|
128 |
foreach (var item in point) |
|
129 |
{ |
|
130 |
dummy.Add(GetPdfPointSystem(item)); |
|
131 |
} |
|
132 |
return dummy; |
|
127 |
return points.ConvertAll(x => GetPdfPointSystem(x)); |
|
133 | 128 |
} |
134 | 129 |
|
135 | 130 |
public double returnAngle(Point start, Point end) |
... | ... | |
178 | 173 |
} |
179 | 174 |
|
180 | 175 |
#region 생성자 & 소멸자 |
176 |
/// <summary> |
|
177 |
/// 주어진 _FinalPDF 데이터로 Final PDF를 생성한다. |
|
178 |
/// </summary> |
|
179 |
/// <param name="_FinalPDF"></param> |
|
181 | 180 |
public void MakeFinalPDF(object _FinalPDF) |
182 | 181 |
{ |
183 | 182 |
DOCUMENT_ITEM documentItem; |
... | ... | |
194 | 193 |
using (KCOMEntities _entity = new KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString())) |
195 | 194 |
{ |
196 | 195 |
var _properties = _entity.PROPERTIES.Where(pro => pro.PROPERTY == FinalPDF.PROJECT_NO); |
197 |
|
|
198 |
if (_properties.Count() > 0) |
|
196 |
if (_properties.Any()) |
|
199 | 197 |
{ |
200 | 198 |
if (_properties.Where(t => t.TYPE == PropertiesType.Const_TileSorcePath).Count() == 0) |
201 | 199 |
{ |
... | ... | |
252 | 250 |
} |
253 | 251 |
#endregion |
254 | 252 |
|
255 |
#region 문서 복사
|
|
253 |
#region 원본 PDF를 TempFile로 복사
|
|
256 | 254 |
try |
257 | 255 |
{ |
258 | 256 |
using (CIEntities _entity = new CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(FinalPDF.PROJECT_NO).ToString())) |
... | ... | |
496 | 494 |
} |
497 | 495 |
|
498 | 496 |
/// <summary> |
499 |
/// PDF에 Markup 데이터를 쓴다.
|
|
497 |
/// 원본 PDF에 Markup을 생성한다.
|
|
500 | 498 |
/// </summary> |
501 | 499 |
/// <param name="finaldata"></param> |
502 | 500 |
/// <param name="testFile"></param> |
... | ... | |
862 | 860 |
case "TextControl": |
863 | 861 |
using (S_TextControl control = JsonSerializerHelper.JsonDeserialize<S_TextControl>(item)) |
864 | 862 |
{ |
865 |
DrawTextBox(control, contentByte, delimiterChars, delimiterChars2, _SetColor);
|
|
863 |
control.Draw(this, contentByte, delimiterChars, delimiterChars2, _SetColor, scaleWidth, scaleHeight);
|
|
866 | 864 |
} |
867 | 865 |
break; |
868 | 866 |
#endregion |
FinalService/KCOM_FinalService/MarkupToPDF/MarkupToPDF.csproj | ||
---|---|---|
26 | 26 |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
27 | 27 |
<DebugType>pdbonly</DebugType> |
28 | 28 |
<Optimize>true</Optimize> |
29 |
<OutputPath>bin\Release\</OutputPath>
|
|
29 |
<OutputPath>..\..\..\Setup\FinalService\</OutputPath>
|
|
30 | 30 |
<DefineConstants>TRACE</DefineConstants> |
31 | 31 |
<ErrorReport>prompt</ErrorReport> |
32 | 32 |
<WarningLevel>4</WarningLevel> |
FinalService/KCOM_FinalService/MarkupToPDF/Serialize/S_Control/Detail/S_TextControl.cs | ||
---|---|---|
13 | 13 |
using MarkupToPDF.Controls.Common; |
14 | 14 |
using MarkupToPDF.Controls.Text; |
15 | 15 |
using CommonLib.MARKUS_API; |
16 |
using iTextSharp.text.pdf; |
|
17 |
using iTextSharp.text; |
|
18 |
using MarkupToPDF.Common; |
|
19 |
using MarkupToPDF.Controls_PDF; |
|
20 |
using System.Linq; |
|
16 | 21 |
|
17 | 22 |
namespace MarkupToPDF.Serialize.S_Control |
18 | 23 |
{ |
... | ... | |
42 | 47 |
} |
43 | 48 |
|
44 | 49 |
/// <summary> |
50 |
/// 텍스트와 보더를 그립니다. |
|
51 |
/// </summary> |
|
52 |
/// <param name="control"></param> |
|
53 |
/// <param name="contentByte"></param> |
|
54 |
/// <param name="delimiterChars"></param> |
|
55 |
/// <param name="delimiterChars2"></param> |
|
56 |
/// <param name="setColor"></param> |
|
57 |
public void Draw(MarkupToPDF pdf, iTextSharp.text.pdf.PdfContentByte contentByte, string[] delimiterChars, string[] delimiterChars2, System.Drawing.Color setColor, |
|
58 |
double ScaleWidth, double ScaleHeight) |
|
59 |
{ |
|
60 |
string[] data2 = this.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
61 |
string Text = this.Text; |
|
62 |
|
|
63 |
bool isUnderline = false; |
|
64 |
this.BoxW -= ScaleWidth; |
|
65 |
this.BoxH -= ScaleHeight; |
|
66 |
System.Drawing.SizeF sizeF = new System.Drawing.SizeF((float)this.BoxW, (float)this.BoxH); |
|
67 |
Point StartPoint = pdf.GetPdfPointSystem(this.StartPoint); |
|
68 |
Point EndPoint = pdf.GetPdfPointSystem(new Point(this.StartPoint.X + this.BoxW, this.StartPoint.Y + this.BoxH)); |
|
69 |
|
|
70 |
var rect = this.GetBorderRectangle(StartPoint, (float)ScaleWidth, (float)ScaleHeight); |
|
71 |
|
|
72 |
List<Point> pointSet = new List<Point>(); |
|
73 |
pointSet.Add(StartPoint); |
|
74 |
pointSet.Add(EndPoint); |
|
75 |
|
|
76 |
PaintSet paint = PaintSet.None; |
|
77 |
switch (this.paintMethod) |
|
78 |
{ |
|
79 |
case 1: |
|
80 |
{ |
|
81 |
paint = PaintSet.Fill; |
|
82 |
} |
|
83 |
break; |
|
84 |
case 2: |
|
85 |
{ |
|
86 |
paint = PaintSet.Hatch; |
|
87 |
} |
|
88 |
break; |
|
89 |
default: |
|
90 |
break; |
|
91 |
} |
|
92 |
if (this.isHighLight) paint |= PaintSet.Highlight; |
|
93 |
|
|
94 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2[0]), ScaleWidth); |
|
95 |
double TextSize = Convert.ToDouble(data2[1]); |
|
96 |
System.Drawing.Color FontColor = setColor; |
|
97 |
double Angle = this.Angle; |
|
98 |
double Opacity = this.Opac; |
|
99 |
FontFamily fontfamilly = Markus.Fonts.FontHelper.GetFontFamily(this.fontConfig[0]); |
|
100 |
var TextStyle = Common.StringToFont.ConFontStyle(this.fontConfig[1]); |
|
101 |
|
|
102 |
FontStyle fontStyle = FontStyles.Normal; |
|
103 |
if (FontStyles.Italic == TextStyle) |
|
104 |
{ |
|
105 |
fontStyle = FontStyles.Italic; |
|
106 |
} |
|
107 |
|
|
108 |
FontWeight fontWeight = FontWeights.Black; |
|
109 |
|
|
110 |
var TextWeight = Common.StringToFont.ConFontWeight(this.fontConfig[2]); |
|
111 |
//강인구 수정(2018.04.17) |
|
112 |
if (FontWeights.Bold == TextWeight) |
|
113 |
{ |
|
114 |
fontWeight = FontWeights.Bold; |
|
115 |
} |
|
116 |
|
|
117 |
TextDecorationCollection decoration = TextDecorations.Baseline; |
|
118 |
if (this.fontConfig.Count == 4) |
|
119 |
{ |
|
120 |
decoration = TextDecorations.Underline; |
|
121 |
} |
|
122 |
|
|
123 |
this.DrawString(StartPoint, EndPoint, LineSize, contentByte, setColor, paint, TextSize, fontfamilly, fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle); |
|
124 |
} |
|
125 |
|
|
126 |
/// <summary> |
|
127 |
/// draw string |
|
128 |
/// </summary> |
|
129 |
/// <param name="sp"></param> |
|
130 |
/// <param name="ep"></param> |
|
131 |
/// <param name="lineSize"></param> |
|
132 |
/// <param name="contentByte"></param> |
|
133 |
/// <param name="color"></param> |
|
134 |
/// <param name="PaintStyle"></param> |
|
135 |
/// <param name="FontSize"></param> |
|
136 |
/// <param name="fontFamilly"></param> |
|
137 |
/// <param name="fontstyle"></param> |
|
138 |
/// <param name="fontweight"></param> |
|
139 |
/// <param name="isUnderline"></param> |
|
140 |
/// <param name="text"></param> |
|
141 |
/// <param name="size"></param> |
|
142 |
/// <param name="opac"></param> |
|
143 |
/// <param name="Angle"></param> |
|
144 |
private void DrawString(Point sp, Point ep, double lineSize, iTextSharp.text.pdf.PdfContentByte contentByte, System.Drawing.Color color, PaintSet PaintStyle, double FontSize, |
|
145 |
FontFamily fontFamilly, FontStyle fontstyle, FontWeight fontweight, TextDecorationCollection isUnderline, |
|
146 |
string text, System.Drawing.SizeF size, double opac, double Angle) |
|
147 |
{ |
|
148 |
if (string.IsNullOrWhiteSpace(text)) |
|
149 |
{ |
|
150 |
text = ""; |
|
151 |
} |
|
152 |
|
|
153 |
BaseColor bs = new BaseColor(color); |
|
154 |
contentByte.SaveState(); |
|
155 |
|
|
156 |
System.Windows.Rect rect = new System.Windows.Rect(sp, ep); |
|
157 |
List<Point> points = new List<Point> |
|
158 |
{ |
|
159 |
rect.TopLeft, rect.BottomLeft, |
|
160 |
rect.BottomRight, rect.TopRight |
|
161 |
}; |
|
162 |
|
|
163 |
double textMargin = 0.5; |
|
164 |
|
|
165 |
/// 점을 중심으로 라인 두께가 그려짐으로 사각형 안쪽으로 텍스트가 쓰여지게 사각형을 키움 |
|
166 |
rect.Inflate(lineSize * textMargin, lineSize * textMargin); |
|
167 |
|
|
168 |
var calRect = MathSet.GetPointsToRectX(points); |
|
169 |
if (lineSize * 2 > calRect.Height) lineSize *= 0.3; /// 텍스트가 뒤집어 지는것 방지 |
|
170 |
if (calRect.Top > calRect.Bottom) |
|
171 |
{ |
|
172 |
calRect.Left += (float)(lineSize * textMargin); |
|
173 |
calRect.Top -= (float)(lineSize * textMargin); |
|
174 |
calRect.Right -= (float)(lineSize * textMargin); |
|
175 |
calRect.Bottom += (float)(lineSize * textMargin); |
|
176 |
} |
|
177 |
else ///Top이 작을 경우(예: 문서를 회전하여 Comment 작업한 경우) |
|
178 |
{ |
|
179 |
calRect.Left += (float)(lineSize * textMargin); |
|
180 |
calRect.Top += (float)(lineSize * textMargin); |
|
181 |
calRect.Right -= (float)(lineSize * textMargin); |
|
182 |
calRect.Bottom -= (float)(lineSize * textMargin); |
|
183 |
} |
|
184 |
|
|
185 |
contentByte.SetLineWidth((float)lineSize); |
|
186 |
|
|
187 |
#region 보더를 그린다. |
|
188 |
/// transform text border |
|
189 |
System.Drawing.PointF[] border = new System.Drawing.PointF[4] |
|
190 |
{ |
|
191 |
new System.Drawing.PointF((float)points[0].X, (float)points[0].Y), |
|
192 |
new System.Drawing.PointF((float)points[1].X, (float)points[1].Y), |
|
193 |
new System.Drawing.PointF((float)points[2].X, (float)points[2].Y), |
|
194 |
new System.Drawing.PointF((float)points[3].X, (float)points[3].Y) |
|
195 |
}; |
|
196 |
|
|
197 |
System.Drawing.Drawing2D.Matrix _mat = new System.Drawing.Drawing2D.Matrix(); |
|
198 |
_mat.RotateAt((float)Angle * -1, new System.Drawing.PointF((float)sp.X, (float)sp.Y)); |
|
199 |
_mat.TransformPoints(border); |
|
200 |
|
|
201 |
contentByte.NewPath(); |
|
202 |
contentByte.MoveTo(border[0].X, border[0].Y); |
|
203 |
|
|
204 |
if ((PaintStyle & PaintSet.Hatch) == PaintSet.Hatch) |
|
205 |
{ |
|
206 |
/// default arc length |
|
207 |
List<Point> rectPoints = new List<Point>(); |
|
208 |
|
|
209 |
for (int i = 1; i <= border.Count(); ++i) |
|
210 |
{ |
|
211 |
rectPoints.Add(new Point(border[i % border.Count()].X, border[i % border.Count()].Y)); |
|
212 |
} |
|
213 |
|
|
214 |
if ((PaintStyle & PaintSet.Highlight) == PaintSet.Highlight) |
|
215 |
{ |
|
216 |
contentByte.NewPath(); |
|
217 |
contentByte.MoveTo(border[0].X, border[0].Y); |
|
218 |
for (int i = 1; i <= border.Count(); ++i) contentByte.LineTo(border[i % border.Count()].X, border[i % border.Count()].Y); |
|
219 |
|
|
220 |
DrawSet_Shape.PaintFill(contentByte, PaintStyle, bs, opac); |
|
221 |
} |
|
222 |
|
|
223 |
double ArcLength = 20 / (MarkupToPDF.scaleWidth > MarkupToPDF.scaleHeight ? MarkupToPDF.scaleWidth : MarkupToPDF.scaleHeight); |
|
224 |
|
|
225 |
List<Point> newPointSet = new List<Point>(); |
|
226 |
|
|
227 |
newPointSet.Add(new Point(border[0].X, border[0].Y)); |
|
228 |
for (int i = 1; i <= border.Count(); ++i) newPointSet.Add(new Point(border[i % points.Count].X, border[i % points.Count].Y)); |
|
229 |
|
|
230 |
Controls_PDF.DrawSet_Cloud.DrawCloud(newPointSet, lineSize, ArcLength, contentByte, new DoubleCollection(), color, color, PaintSet.None, opac); |
|
231 |
} |
|
232 |
else if (((PaintStyle & PaintSet.Highlight) == PaintSet.Highlight) || ((PaintStyle & PaintSet.Fill) == PaintSet.Fill)) |
|
233 |
{ |
|
234 |
for (int i = 1; i <= border.Count(); ++i) contentByte.LineTo(border[i % border.Count()].X, border[i % border.Count()].Y); |
|
235 |
|
|
236 |
DrawSet_Text.PaintFill(contentByte, PaintStyle, bs); |
|
237 |
} |
|
238 |
#endregion |
|
239 |
|
|
240 |
System.Drawing.Drawing2D.Matrix mat = new System.Drawing.Drawing2D.Matrix(); |
|
241 |
|
|
242 |
iTextSharp.text.Rectangle TextBox = null; |
|
243 |
#region TextBox에 크기에 맞게 폰트를 생성한다. |
|
244 |
iTextSharp.text.Font itextFont = null; |
|
245 |
Angle = Angle < 0 ? Angle + 360.0 : Angle; |
|
246 |
if (Convert.ToInt32(Angle) == 0 || (Convert.ToInt32(Angle) == 360)) |
|
247 |
{ |
|
248 |
TextBox = calRect; |
|
249 |
itextFont = CommonFont.CreateFont(fontFamilly, fontstyle, fontweight, isUnderline, TextBox, text); |
|
250 |
} |
|
251 |
/* |
|
252 |
else if (Convert.ToInt32(Angle) == 90 || Convert.ToInt32(Angle) == 180 || Convert.ToInt32(Angle) == 270) |
|
253 |
{ |
|
254 |
TextBox = calRect; |
|
255 |
itextFont = CommonFont.CreateFont(fontFamilly, fontstyle, fontweight, isUnderline, TextBox, text); |
|
256 |
|
|
257 |
#region 이동 후 회전 |
|
258 |
mat.RotateAt((float)Angle * -1, new System.Drawing.PointF((float)sp.X, (float)sp.Y)); |
|
259 |
mat.Translate((float)textMargin, (float)textMargin); |
|
260 |
#endregion |
|
261 |
} |
|
262 |
*/ |
|
263 |
else |
|
264 |
{ |
|
265 |
TextBox = calRect; |
|
266 |
itextFont = CommonFont.CreateFont(fontFamilly, fontstyle, fontweight, isUnderline, TextBox, text); |
|
267 |
|
|
268 |
mat.RotateAt((float)Angle * -1, new System.Drawing.PointF((float)sp.X, (float)sp.Y)); |
|
269 |
mat.Translate((float)textMargin, (float)textMargin); |
|
270 |
} |
|
271 |
#endregion |
|
272 |
|
|
273 |
#region 텍스트 쓰기 |
|
274 |
contentByte.SetColorStroke(bs); |
|
275 |
contentByte.SetColorFill(bs); |
|
276 |
|
|
277 |
string[] tokens = text.Split(new[] { Environment.NewLine, "\r" }, StringSplitOptions.None); |
|
278 |
ColumnText ct = new ColumnText(contentByte); |
|
279 |
PdfGState gs3 = new PdfGState(); |
|
280 |
gs3.StrokeOpacity = (float)opac; |
|
281 |
gs3.FillOpacity = (float)opac; |
|
282 |
|
|
283 |
ct.Canvas.Transform(mat); |
|
284 |
ct.Canvas.SetGState(gs3); |
|
285 |
float fLeadingSize = (TextBox.Height / (float)tokens.Length); |
|
286 |
float spacing = ((float)TextBox.Height - tokens.Length * itextFont.CalculatedSize) / (tokens.Length + 2); |
|
287 |
/// add paddings |
|
288 |
TextBox.Right += (float)(lineSize * 0.5); |
|
289 |
if (TextBox.Top > TextBox.Bottom) |
|
290 |
TextBox.Bottom -= (float)(lineSize * 0.5); |
|
291 |
else |
|
292 |
TextBox.Top -= (float)(lineSize * 0.5); |
|
293 |
/// up to here |
|
294 |
ct.SetLeading(itextFont.CalculatedSize + (float)((tokens.Length > 1) ? spacing : 0), ct.MultipliedLeading); |
|
295 |
ct.SetSimpleColumn(TextBox); |
|
296 |
ct.Alignment = Element.ALIGN_MIDDLE | Element.ALIGN_CENTER; |
|
297 |
ct.SetText(new Phrase(new Chunk(text, itextFont))); |
|
298 |
ct.Go(); |
|
299 |
#endregion |
|
300 |
|
|
301 |
contentByte.RestoreState(); |
|
302 |
} |
|
303 |
|
|
304 |
/// <summary> |
|
45 | 305 |
/// Border 사각형을 리턴한다. |
46 | 306 |
/// </summary> |
47 | 307 |
/// <param name="Origin"></param> |
FinalService/KCOM_FinalService_DL/MarkupToPDF/Controls_PDF/DrawSet_DrawString.cs | ||
---|---|---|
249 | 249 |
} |
250 | 250 |
} |
251 | 251 |
|
252 |
private static void PaintFill(PdfContentByte contentByte, PaintSet PaintStyle, BaseColor bs)
|
|
252 |
public static void PaintFill(PdfContentByte contentByte, PaintSet PaintStyle, BaseColor bs)
|
|
253 | 253 |
{ |
254 | 254 |
if ((PaintStyle & PaintSet.Highlight) == PaintSet.Highlight) |
255 | 255 |
{ |
FinalService/KCOM_FinalService_DL/MarkupToPDF/Controls_PDF/DrawSet_Shape.cs | ||
---|---|---|
107 | 107 |
//contentByte.ClosePath(); |
108 | 108 |
} |
109 | 109 |
|
110 |
public static void DrawPolygon(List<System.Drawing.PointF> points, double lineSize, PdfContentByte contentByte, System.Windows.Media.DoubleCollection DashSize, |
|
111 |
System.Drawing.Color color, PaintSet PaintStyle, double opac) |
|
112 |
{ |
|
113 |
BaseColor bs = new BaseColor(color); |
|
114 |
contentByte.SaveState(); |
|
115 |
PdfGState gs1 = new PdfGState(); |
|
116 |
gs1.StrokeOpacity = (float)opac; |
|
117 |
gs1.FillOpacity = (float)opac; |
|
118 |
contentByte.SetGState(gs1); |
|
119 |
var rect = contentByte.PdfDocument.PageSize; |
|
120 |
contentByte.SetColorStroke(bs); |
|
121 |
if (DashSize.Count > 1) |
|
122 |
{ |
|
123 |
List<float> DashSet = new List<float>(); |
|
124 |
DashSize.ToList().ForEach(data => DashSet.Add((float)data * 1)); |
|
125 |
contentByte.SetLineDash(DashSet.ToArray(), DashSet.Count - 2); |
|
126 |
} |
|
127 |
|
|
128 |
contentByte.SetLineWidth((float)lineSize); |
|
129 |
|
|
130 |
contentByte.NewPath(); |
|
131 |
|
|
132 |
//사용은 가능하지만 연결성이 떨어짐 |
|
133 |
for (int i = 0; i < points.Count(); i++) |
|
134 |
{ |
|
135 |
if (i == 0) |
|
136 |
{ |
|
137 |
contentByte.MoveTo((float)points[i].X, (float)points[i].Y); |
|
138 |
} |
|
139 |
else |
|
140 |
{ |
|
141 |
contentByte.LineTo((float)points[i].X, (float)points[i].Y); |
|
142 |
} |
|
143 |
|
|
144 |
if (i == points.Count() - 1) |
|
145 |
{ |
|
146 |
contentByte.LineTo((float)points[i].X, (float)points[i].Y); |
|
147 |
|
|
148 |
if (points[i] != points[0]) |
|
149 |
{ |
|
150 |
contentByte.Stroke(); |
|
151 |
} |
|
152 |
|
|
153 |
} |
|
154 |
} |
|
155 |
|
|
156 |
|
|
157 |
DrawSet_Shape.PaintFill(contentByte, PaintStyle, bs, opac); |
|
158 |
contentByte.RestoreState(); |
|
159 |
//contentByte.ClosePath(); |
|
160 |
} |
|
161 |
|
|
110 | 162 |
public static void DrawTriangle(List<Point> points, double lineSize, PdfContentByte contentByte, System.Windows.Media.DoubleCollection DashSize, |
111 | 163 |
System.Drawing.Color color, PaintSet PaintStyle, double opac) |
112 | 164 |
{ |
FinalService/KCOM_FinalService_DL/MarkupToPDF/Controls_PDF/DrawSet_Symbol.cs | ||
---|---|---|
121 | 121 |
|
122 | 122 |
sendReqLog("CheckMarkImgPath", ImgPath); |
123 | 123 |
Image img = Image.GetInstance(new Uri(ImgPath)); |
124 |
|
|
124 |
|
|
125 | 125 |
double ratioX = Rect3.Width / (double)img.Width; |
126 | 126 |
double ratioY = Rect3.Height / (double)img.Height; |
127 | 127 |
double ratio = Math.Min(ratioX, ratioY); |
FinalService/KCOM_FinalService_DL/MarkupToPDF/Controls_PDF/PDFLib_DrawSet_Text.cs | ||
---|---|---|
66 | 66 |
|
67 | 67 |
public static void DrawDate(Point sp, Point ep, List<Point> pointSet, PdfContentByte contentByte, System.Drawing.Color color, string text, double angle, double opac) |
68 | 68 |
{ |
69 |
|
|
70 |
|
|
71 | 69 |
bool isError = false; |
72 | 70 |
BaseColor bs = new BaseColor(color); |
73 | 71 |
contentByte.SaveState(); |
... | ... | |
106 | 104 |
|
107 | 105 |
var fontSize = (int)size.Height; |
108 | 106 |
float width = bf.GetWidthPoint(text, fontSize); |
109 |
float height = bf.GetAscentPoint(text, fontSize) |
|
110 |
- bf.GetDescentPoint(text, fontSize); |
|
111 |
|
|
107 |
float height = bf.GetAscentPoint(text, fontSize) - bf.GetDescentPoint(text, fontSize); |
|
112 | 108 |
|
113 | 109 |
PdfTemplate template = contentByte.CreateTemplate(width, height + 1); |
114 | 110 |
template.BeginText(); |
FinalService/KCOM_FinalService_DL/MarkupToPDF/MarkupToPDF.cs | ||
---|---|---|
977 | 977 |
case "TextControl": |
978 | 978 |
using (S_TextControl control = JsonSerializerHelper.JsonDeserialize<S_TextControl>(item)) |
979 | 979 |
{ |
980 |
DrawTextBox(control, contentByte, delimiterChars, delimiterChars2, _SetColor);
|
|
980 |
control.Draw(this, contentByte, delimiterChars, delimiterChars2, _SetColor, scaleWidth, scaleHeight);
|
|
981 | 981 |
} |
982 | 982 |
break; |
983 | 983 |
#endregion |
FinalService/KCOM_FinalService_DL/MarkupToPDF/Serialize/Core/JsonSerializerHelper.cs | ||
---|---|---|
27 | 27 |
/// <param name="json">Json 데이터가 들어와야 합니다.</param> |
28 | 28 |
/// <returns></returns> |
29 | 29 |
|
30 |
|
|
31 | 30 |
public static TObj JsonDeserialize<TObj>(this string json) |
32 | 31 |
{ |
33 | 32 |
|
FinalService/KCOM_FinalService_DL/MarkupToPDF/Serialize/S_Control/Detail/S_CloudControl.cs | ||
---|---|---|
40 | 40 |
|
41 | 41 |
[DataMember] |
42 | 42 |
public DoubleCollection DashSize { get; set; } |
43 |
|
|
44 | 43 |
public void Dispose() |
45 | 44 |
{ |
46 | 45 |
GC.Collect(); |
FinalService/KCOM_FinalService_DL/MarkupToPDF/Serialize/S_Control/Detail/S_TextControl.cs | ||
---|---|---|
13 | 13 |
using MarkupToPDF.Controls.Common; |
14 | 14 |
using MarkupToPDF.Controls.Text; |
15 | 15 |
using CommonLib.MARKUS_API; |
16 |
using iTextSharp.text.pdf; |
|
17 |
using iTextSharp.text; |
|
18 |
using MarkupToPDF.Common; |
|
19 |
using MarkupToPDF.Controls_PDF; |
|
20 |
using System.Linq; |
|
16 | 21 |
|
17 | 22 |
namespace MarkupToPDF.Serialize.S_Control |
18 | 23 |
{ |
... | ... | |
42 | 47 |
} |
43 | 48 |
|
44 | 49 |
/// <summary> |
50 |
/// 텍스트와 보더를 그립니다. |
|
51 |
/// </summary> |
|
52 |
/// <param name="control"></param> |
|
53 |
/// <param name="contentByte"></param> |
|
54 |
/// <param name="delimiterChars"></param> |
|
55 |
/// <param name="delimiterChars2"></param> |
|
56 |
/// <param name="setColor"></param> |
|
57 |
public void Draw(MarkupToPDF pdf, iTextSharp.text.pdf.PdfContentByte contentByte, string[] delimiterChars, string[] delimiterChars2, System.Drawing.Color setColor, |
|
58 |
double ScaleWidth, double ScaleHeight) |
|
59 |
{ |
|
60 |
string[] data2 = this.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
61 |
string Text = this.Text; |
|
62 |
|
|
63 |
bool isUnderline = false; |
|
64 |
this.BoxW -= ScaleWidth; |
|
65 |
this.BoxH -= ScaleHeight; |
|
66 |
System.Drawing.SizeF sizeF = new System.Drawing.SizeF((float)this.BoxW, (float)this.BoxH); |
|
67 |
Point StartPoint = pdf.GetPdfPointSystem(this.StartPoint); |
|
68 |
Point EndPoint = pdf.GetPdfPointSystem(new Point(this.StartPoint.X + this.BoxW, this.StartPoint.Y + this.BoxH)); |
|
69 |
|
|
70 |
var rect = this.GetBorderRectangle(StartPoint, (float)ScaleWidth, (float)ScaleHeight); |
|
71 |
|
|
72 |
List<Point> pointSet = new List<Point>(); |
|
73 |
pointSet.Add(StartPoint); |
|
74 |
pointSet.Add(EndPoint); |
|
75 |
|
|
76 |
PaintSet paint = PaintSet.None; |
|
77 |
switch (this.paintMethod) |
|
78 |
{ |
|
79 |
case 1: |
|
80 |
{ |
|
81 |
paint = PaintSet.Fill; |
|
82 |
} |
|
83 |
break; |
|
84 |
case 2: |
|
85 |
{ |
|
86 |
paint = PaintSet.Hatch; |
|
87 |
} |
|
88 |
break; |
|
89 |
default: |
|
90 |
break; |
|
91 |
} |
|
92 |
if (this.isHighLight) paint |= PaintSet.Highlight; |
|
93 |
|
|
94 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2[0]), ScaleWidth); |
|
95 |
double TextSize = Convert.ToDouble(data2[1]); |
|
96 |
System.Drawing.Color FontColor = setColor; |
|
97 |
double Angle = this.Angle; |
|
98 |
double Opacity = this.Opac; |
|
99 |
FontFamily fontfamilly = Markus.Fonts.FontHelper.GetFontFamily(this.fontConfig[0]); |
|
100 |
var TextStyle = Common.StringToFont.ConFontStyle(this.fontConfig[1]); |
|
101 |
|
|
102 |
FontStyle fontStyle = FontStyles.Normal; |
|
103 |
if (FontStyles.Italic == TextStyle) |
|
104 |
{ |
|
105 |
fontStyle = FontStyles.Italic; |
|
106 |
} |
|
107 |
|
|
108 |
FontWeight fontWeight = FontWeights.Black; |
|
109 |
|
|
110 |
var TextWeight = Common.StringToFont.ConFontWeight(this.fontConfig[2]); |
|
111 |
//강인구 수정(2018.04.17) |
|
112 |
if (FontWeights.Bold == TextWeight) |
|
113 |
{ |
|
114 |
fontWeight = FontWeights.Bold; |
|
115 |
} |
|
116 |
|
|
117 |
TextDecorationCollection decoration = TextDecorations.Baseline; |
|
118 |
if (this.fontConfig.Count == 4) |
|
119 |
{ |
|
120 |
decoration = TextDecorations.Underline; |
|
121 |
} |
|
122 |
|
|
123 |
this.DrawString(StartPoint, EndPoint, LineSize, contentByte, setColor, paint, TextSize, fontfamilly, fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle); |
|
124 |
} |
|
125 |
|
|
126 |
/// <summary> |
|
127 |
/// draw string |
|
128 |
/// </summary> |
|
129 |
/// <param name="sp"></param> |
|
130 |
/// <param name="ep"></param> |
|
131 |
/// <param name="lineSize"></param> |
|
132 |
/// <param name="contentByte"></param> |
|
133 |
/// <param name="color"></param> |
|
134 |
/// <param name="PaintStyle"></param> |
|
135 |
/// <param name="FontSize"></param> |
|
136 |
/// <param name="fontFamilly"></param> |
|
137 |
/// <param name="fontstyle"></param> |
|
138 |
/// <param name="fontweight"></param> |
|
139 |
/// <param name="isUnderline"></param> |
|
140 |
/// <param name="text"></param> |
|
141 |
/// <param name="size"></param> |
|
142 |
/// <param name="opac"></param> |
|
143 |
/// <param name="Angle"></param> |
|
144 |
private void DrawString(Point sp, Point ep, double lineSize, iTextSharp.text.pdf.PdfContentByte contentByte, System.Drawing.Color color, PaintSet PaintStyle, double FontSize, |
|
145 |
FontFamily fontFamilly, FontStyle fontstyle, FontWeight fontweight, TextDecorationCollection isUnderline, |
|
146 |
string text, System.Drawing.SizeF size, double opac, double Angle) |
|
147 |
{ |
|
148 |
if (string.IsNullOrWhiteSpace(text)) |
|
149 |
{ |
|
150 |
text = ""; |
|
151 |
} |
|
152 |
|
|
153 |
BaseColor bs = new BaseColor(color); |
|
154 |
contentByte.SaveState(); |
|
155 |
|
|
156 |
System.Windows.Rect rect = new System.Windows.Rect(sp, ep); |
|
157 |
List<Point> points = new List<Point> |
|
158 |
{ |
|
159 |
rect.TopLeft, rect.BottomLeft, |
|
160 |
rect.BottomRight, rect.TopRight |
|
161 |
}; |
|
162 |
|
|
163 |
double textMargin = 0.5; |
|
164 |
|
|
165 |
/// 점을 중심으로 라인 두께가 그려짐으로 사각형 안쪽으로 텍스트가 쓰여지게 사각형을 키움 |
|
166 |
rect.Inflate(lineSize * textMargin, lineSize * textMargin); |
|
167 |
|
|
168 |
var calRect = MathSet.GetPointsToRectX(points); |
|
169 |
if (lineSize * 2 > calRect.Height) lineSize *= 0.3; /// 텍스트가 뒤집어 지는것 방지 |
|
170 |
if (calRect.Top > calRect.Bottom) |
|
171 |
{ |
|
172 |
calRect.Left += (float)(lineSize * textMargin); |
|
173 |
calRect.Top -= (float)(lineSize * textMargin); |
|
174 |
calRect.Right -= (float)(lineSize * textMargin); |
|
175 |
calRect.Bottom += (float)(lineSize * textMargin); |
|
176 |
} |
|
177 |
else ///Top이 작을 경우(예: 문서를 회전하여 Comment 작업한 경우) |
|
178 |
{ |
|
179 |
calRect.Left += (float)(lineSize * textMargin); |
|
180 |
calRect.Top += (float)(lineSize * textMargin); |
|
181 |
calRect.Right -= (float)(lineSize * textMargin); |
|
182 |
calRect.Bottom -= (float)(lineSize * textMargin); |
|
183 |
} |
|
184 |
|
|
185 |
contentByte.SetLineWidth((float)lineSize); |
|
186 |
|
|
187 |
#region 보더를 그린다. |
|
188 |
/// transform text border |
|
189 |
System.Drawing.PointF[] border = new System.Drawing.PointF[4] |
|
190 |
{ |
|
191 |
new System.Drawing.PointF((float)points[0].X, (float)points[0].Y), |
|
192 |
new System.Drawing.PointF((float)points[1].X, (float)points[1].Y), |
|
193 |
new System.Drawing.PointF((float)points[2].X, (float)points[2].Y), |
|
194 |
new System.Drawing.PointF((float)points[3].X, (float)points[3].Y) |
|
195 |
}; |
|
196 |
|
|
197 |
System.Drawing.Drawing2D.Matrix _mat = new System.Drawing.Drawing2D.Matrix(); |
|
198 |
_mat.RotateAt((float)Angle * -1, new System.Drawing.PointF((float)sp.X, (float)sp.Y)); |
|
199 |
_mat.TransformPoints(border); |
|
200 |
|
|
201 |
contentByte.NewPath(); |
|
202 |
contentByte.MoveTo(border[0].X, border[0].Y); |
|
203 |
|
|
204 |
if ((PaintStyle & PaintSet.Hatch) == PaintSet.Hatch) |
|
205 |
{ |
|
206 |
/// default arc length |
|
207 |
List<Point> rectPoints = new List<Point>(); |
|
208 |
|
|
209 |
for (int i = 1; i <= border.Count(); ++i) |
|
210 |
{ |
|
211 |
rectPoints.Add(new Point(border[i % border.Count()].X, border[i % border.Count()].Y)); |
|
212 |
} |
|
213 |
|
|
214 |
if ((PaintStyle & PaintSet.Highlight) == PaintSet.Highlight) |
|
215 |
{ |
|
216 |
contentByte.NewPath(); |
|
217 |
contentByte.MoveTo(border[0].X, border[0].Y); |
|
218 |
for (int i = 1; i <= border.Count(); ++i) contentByte.LineTo(border[i % border.Count()].X, border[i % border.Count()].Y); |
|
219 |
|
|
220 |
DrawSet_Shape.PaintFill(contentByte, PaintStyle, bs, opac); |
|
221 |
} |
|
222 |
|
|
223 |
double ArcLength = 20 / (MarkupToPDF.scaleWidth > MarkupToPDF.scaleHeight ? MarkupToPDF.scaleWidth : MarkupToPDF.scaleHeight); |
|
224 |
|
|
225 |
List<Point> newPointSet = new List<Point>(); |
|
226 |
|
|
227 |
newPointSet.Add(new Point(border[0].X, border[0].Y)); |
|
228 |
for (int i = 1; i <= border.Count(); ++i) newPointSet.Add(new Point(border[i % points.Count].X, border[i % points.Count].Y)); |
|
229 |
|
|
230 |
Controls_PDF.DrawSet_Cloud.DrawCloud(newPointSet, lineSize, ArcLength, contentByte, new DoubleCollection(), color, color, PaintSet.None, opac); |
|
231 |
} |
|
232 |
else if (((PaintStyle & PaintSet.Highlight) == PaintSet.Highlight) || ((PaintStyle & PaintSet.Fill) == PaintSet.Fill)) |
|
233 |
{ |
|
234 |
for (int i = 1; i <= border.Count(); ++i) contentByte.LineTo(border[i % border.Count()].X, border[i % border.Count()].Y); |
|
235 |
|
|
236 |
DrawSet_Text.PaintFill(contentByte, PaintStyle, bs); |
|
237 |
} |
|
238 |
#endregion |
|
239 |
|
|
240 |
System.Drawing.Drawing2D.Matrix mat = new System.Drawing.Drawing2D.Matrix(); |
|
241 |
|
|
242 |
iTextSharp.text.Rectangle TextBox = null; |
|
243 |
#region TextBox에 크기에 맞게 폰트를 생성한다. |
|
244 |
iTextSharp.text.Font itextFont = null; |
|
245 |
Angle = Angle < 0 ? Angle + 360.0 : Angle; |
|
246 |
if (Convert.ToInt32(Angle) == 0 || (Convert.ToInt32(Angle) == 360)) |
|
247 |
{ |
|
248 |
TextBox = calRect; |
|
249 |
itextFont = CommonFont.CreateFont(fontFamilly, fontstyle, fontweight, isUnderline, TextBox, text); |
|
250 |
} |
|
251 |
/* |
|
252 |
else if (Convert.ToInt32(Angle) == 90 || Convert.ToInt32(Angle) == 180 || Convert.ToInt32(Angle) == 270) |
|
253 |
{ |
|
254 |
TextBox = calRect; |
|
255 |
itextFont = CommonFont.CreateFont(fontFamilly, fontstyle, fontweight, isUnderline, TextBox, text); |
|
256 |
|
|
257 |
#region 이동 후 회전 |
|
258 |
mat.RotateAt((float)Angle * -1, new System.Drawing.PointF((float)sp.X, (float)sp.Y)); |
|
259 |
mat.Translate((float)textMargin, (float)textMargin); |
|
260 |
#endregion |
|
261 |
} |
|
262 |
*/ |
|
263 |
else |
|
264 |
{ |
|
265 |
TextBox = calRect; |
|
266 |
itextFont = CommonFont.CreateFont(fontFamilly, fontstyle, fontweight, isUnderline, TextBox, text); |
|
267 |
|
|
268 |
mat.RotateAt((float)Angle * -1, new System.Drawing.PointF((float)sp.X, (float)sp.Y)); |
|
269 |
mat.Translate((float)textMargin, (float)textMargin); |
|
270 |
} |
|
271 |
#endregion |
|
272 |
|
|
273 |
#region 텍스트 쓰기 |
|
274 |
contentByte.SetColorStroke(bs); |
|
275 |
contentByte.SetColorFill(bs); |
|
276 |
|
|
277 |
string[] tokens = text.Split(new[] { Environment.NewLine, "\r" }, StringSplitOptions.None); |
|
278 |
ColumnText ct = new ColumnText(contentByte); |
|
279 |
PdfGState gs3 = new PdfGState(); |
|
280 |
gs3.StrokeOpacity = (float)opac; |
|
281 |
gs3.FillOpacity = (float)opac; |
|
282 |
|
|
283 |
ct.Canvas.Transform(mat); |
|
284 |
ct.Canvas.SetGState(gs3); |
|
285 |
float fLeadingSize = (TextBox.Height / (float)tokens.Length); |
|
286 |
float spacing = ((float)TextBox.Height - tokens.Length * itextFont.CalculatedSize) / (tokens.Length + 2); |
|
287 |
/// add paddings |
|
288 |
TextBox.Right += (float)(lineSize * 0.5); |
|
289 |
if (TextBox.Top > TextBox.Bottom) |
|
290 |
TextBox.Bottom -= (float)(lineSize * 0.5); |
|
291 |
else |
|
292 |
TextBox.Top -= (float)(lineSize * 0.5); |
|
293 |
/// up to here |
|
294 |
ct.SetLeading(itextFont.CalculatedSize + (float)((tokens.Length > 1) ? spacing : 0), ct.MultipliedLeading); |
|
295 |
ct.SetSimpleColumn(TextBox); |
|
296 |
ct.Alignment = Element.ALIGN_MIDDLE | Element.ALIGN_CENTER; |
|
297 |
ct.SetText(new Phrase(new Chunk(text, itextFont))); |
|
298 |
ct.Go(); |
|
299 |
#endregion |
|
300 |
|
|
301 |
contentByte.RestoreState(); |
|
302 |
} |
|
303 |
|
|
304 |
/// <summary> |
|
45 | 305 |
/// Border 사각형을 리턴한다. |
46 | 306 |
/// </summary> |
47 | 307 |
/// <param name="Origin"></param> |
내보내기 Unified diff