개정판 23b7be0e
issue #937: fixed some codes
Change-Id: I14bb54783f812aa8ee94bb0ebf18bee2757d6e18
FinalService/KCOM_FinalService/MarkupToPDF/Controls/Common/PaintSet.cs | ||
---|---|---|
9 | 9 |
public enum PaintSet |
10 | 10 |
{ |
11 | 11 |
None = 0, |
12 |
|
|
13 |
//Rect = 1, |
|
14 |
|
|
15 | 12 |
Fill = 1, |
16 |
|
|
17 |
//Cloud = 2 |
|
18 |
|
|
19 |
Hatch = 2 |
|
13 |
Hatch = 2, |
|
14 |
HIGHLIGHT=3 |
|
20 | 15 |
}; |
16 |
|
|
21 | 17 |
public enum LineStyleSet |
22 | 18 |
{ |
23 | 19 |
SingleLine = 0, |
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/DrawSet_Cloud.cs | ||
---|---|---|
1 |
using iTextSharp.text; |
|
2 |
using iTextSharp.text.pdf; |
|
3 |
using MarkupToPDF.Controls.Common; |
|
4 |
using System; |
|
5 |
using System.Collections.Generic; |
|
6 |
using System.Linq; |
|
7 |
using System.Text; |
|
8 |
using System.Windows; |
|
9 |
using System.Windows.Media; |
|
10 |
|
|
11 |
namespace MarkupToPDF.Controls_PDF |
|
12 |
{ |
|
13 |
public class DrawSet_Cloud : BaseMethod |
|
14 |
{ |
|
15 |
public static double returnAngle(Point start, Point end) |
|
16 |
{ |
|
17 |
double angle = MathSet.getAngle(start.X, start.Y, end.X, end.Y); |
|
18 |
angle += 90; |
|
19 |
|
|
20 |
return angle; |
|
21 |
} |
|
22 |
|
|
23 |
/// <summary> |
|
24 |
/// generate cloud between given p1 and p2 |
|
25 |
/// </summary> |
|
26 |
/// <param name="p1"></param> |
|
27 |
/// <param name="p2"></param> |
|
28 |
/// <param name="arcLengthOrigin"></param> |
|
29 |
/// <param name="contentByte"></param> |
|
30 |
public static void GenerateLineWithCloud(Point p1, Point p2, double arcLength , PdfContentByte contentByte) |
|
31 |
{ |
|
32 |
double l = MathSet.DistanceTo(p1, p2); /// p1와 p2의 길이 |
|
33 |
arcLength = (l < arcLength) ? l : arcLength; |
|
34 |
double dx = (p2.X - p1.X) / l; |
|
35 |
double dy = (p2.Y - p1.Y) / l; |
|
36 |
Point norm = MathSet.RotateAbout(new Point(0, 0), new Point(dx, dy), 90); |
|
37 |
|
|
38 |
double count = l / arcLength; // 두 선의 길이에서 normalize 된 사이즈만큼을 나눠 진행 수치의 갯수 파악 |
|
39 |
|
|
40 |
Point lastPt = new Point(p1.X, p1.Y); |
|
41 |
Point uses = new Point(0, 0); //사용된 값 누적치 |
|
42 |
uses = lastPt; //Point 첫번째꺼 대입 |
|
43 |
contentByte.MoveTo((float)lastPt.X, (float)lastPt.Y); |
|
44 |
|
|
45 |
for (int j = 0; j < count; j++) //dx , dy의 횟수차로 증감치를 결정 |
|
46 |
{ |
|
47 |
/// update last point |
|
48 |
if (j == count - 1) |
|
49 |
{ |
|
50 |
lastPt.X = p2.X; |
|
51 |
lastPt.Y = p2.Y; |
|
52 |
} |
|
53 |
else |
|
54 |
{ |
|
55 |
lastPt.X = lastPt.X + dx * arcLength; |
|
56 |
lastPt.Y = lastPt.Y + dy * arcLength; /// Y축 반전 |
|
57 |
} |
|
58 |
|
|
59 |
var midP = MathSet.getMiddlePoint(uses, lastPt); //시작점과 끝점의 중간점 |
|
60 |
contentByte.CurveTo((float)uses.X, (float)uses.Y, (float)midP.X - norm.X * arcLength*0.3, (float)midP.Y - norm.Y*arcLength*0.3, (float)lastPt.X, (float)lastPt.Y); |
|
61 |
uses.X = lastPt.X; |
|
62 |
uses.Y = lastPt.Y; |
|
63 |
} |
|
64 |
|
|
65 |
l = MathSet.DistanceTo(uses, p2); /// 남은 거리 계산 |
|
66 |
if (l > 0) |
|
67 |
{ |
|
68 |
var midP = MathSet.getMiddlePoint(uses, p2); //시작점과 끝점의 중간점 |
|
69 |
contentByte.CurveTo((float)uses.X, (float)uses.Y, (float)midP.X - norm.X * l*0.3, (float)midP.Y - norm.Y*l*0.3, (float)p2.X, (float)p2.Y); |
|
70 |
} |
|
71 |
} |
|
72 |
|
|
73 |
public static void DrawCloud(List<Point> points, double lineSize, double arcLength, PdfContentByte contentByte, System.Windows.Media.DoubleCollection DashSize, |
|
74 |
SolidColorBrush color, PaintSet PaintStyle, double opac) |
|
75 |
{ |
|
76 |
BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A); |
|
77 |
contentByte.SaveState(); |
|
78 |
|
|
79 |
PdfGState gs1 = new PdfGState(); |
|
80 |
gs1.StrokeOpacity = (float)opac; |
|
81 |
gs1.FillOpacity = (float)opac; |
|
82 |
contentByte.SetGState(gs1); |
|
83 |
var rect = contentByte.PdfDocument.PageSize; |
|
84 |
contentByte.SetColorStroke(bs); |
|
85 |
List<float> DashSet = new List<float>(); |
|
86 |
|
|
87 |
/// WPF defines a device-independent pixel as 1 / 96 per inch |
|
88 |
/// iTextSharp : "the default for the size of the unit in default user space (1/72 inch) |
|
89 |
lineSize = lineSize * 72 / 96*0.5; |
|
90 |
|
|
91 |
DashSize.ToList().ForEach(data => DashSet.Add((float)data * 2)); |
|
92 |
contentByte.SetLineDash(DashSet.ToArray(), DashSet.Count - 2); |
|
93 |
contentByte.SetLineWidth((float)lineSize); |
|
94 |
|
|
95 |
var getMidSet = MathSet.FindCentroid(points); |
|
96 |
contentByte.NewPath(); |
|
97 |
{ |
|
98 |
double area = MathSet.AreaOf(points); |
|
99 |
if (area < 0) points.Reverse(); |
|
100 |
int count = points.Count; |
|
101 |
for (int i = 0; i < count; i++) |
|
102 |
{ |
|
103 |
GenerateLineWithCloud(points[i % count], points[(i + 1) % count], arcLength, contentByte); |
|
104 |
} |
|
105 |
|
|
106 |
HoneyPDFLib_DrawSet_Shape.PaintFill(contentByte, PaintStyle, bs); |
|
107 |
} |
|
108 |
contentByte.RestoreState(); |
|
109 |
} |
|
110 |
} |
|
111 |
} |
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/DrawSet_Symbol.cs | ||
---|---|---|
14 | 14 |
{ |
15 | 15 |
public static void DrawApproval(Point sp, Point ep, List<Point> pointSet, PdfContentByte contentByte, SolidColorBrush color, double Angle, double opac) |
16 | 16 |
{ |
17 |
///TODO: move below APPROVED_CODE to external |
|
17 | 18 |
string APPROVED_CODE = @"iVBORw0KGgoAAAANSUhEUgAAAfAAAADYCAYAAAAUJLEJAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACHDwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAEjHnZZ3VFTXFofPvXd6oc0w0hl6ky4wgPQuIB0EURhmBhjKAMMMTWyIqEBEEREBRZCggAGjoUisiGIhKKhgD0gQUGIwiqioZEbWSnx5ee/l5ffHvd/aZ+9z99l7n7UuACRPHy4vBZYCIJkn4Ad6ONNXhUfQsf0ABniAAaYAMFnpqb5B7sFAJC83F3q6yAn8i94MAUj8vmXo6U+ng/9P0qxUvgAAyF/E5mxOOkvE+SJOyhSkiu0zIqbGJIoZRomZL0pQxHJijlvkpZ99FtlRzOxkHlvE4pxT2clsMfeIeHuGkCNixEfEBRlcTqaIb4tYM0mYzBXxW3FsMoeZDgCKJLYLOKx4EZuImMQPDnQR8XIAcKS4LzjmCxZwsgTiQ7mkpGbzuXHxArouS49uam3NoHtyMpM4AoGhP5OVyOSz6S4pyalMXjYAi2f+LBlxbemiIluaWltaGpoZmX5RqP+6+Dcl7u0ivQr43DOI1veH7a/8UuoAYMyKarPrD1vMfgA6tgIgd/8Pm+YhACRFfWu/8cV5aOJ5iRcIUm2MjTMzM424HJaRuKC/6386/A198T0j8Xa/l4fuyollCpMEdHHdWClJKUI+PT2VyeLQDf88xP848K/zWBrIieXwOTxRRKhoyri8OFG7eWyugJvCo3N5/6mJ/zDsT1qca5Eo9Z8ANcoISN2gAuTnPoCiEAESeVDc9d/75oMPBeKbF6Y6sTj3nwX9+65wifiRzo37HOcSGExnCfkZi2viawnQgAAkARXIAxWgAXSBITADVsAWOAI3sAL4g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wZYa5Z |
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/HoneyPDFLib_DrawSet_Arc.cs | ||
---|---|---|
10 | 10 |
{ |
11 | 11 |
public class HoneyPDFLib_DrawSet_Arc : BaseMethod |
12 | 12 |
{ |
13 |
public static void DrawArc(System.Windows.Point p1, System.Windows.Point p2, System.Windows.Point p3, int lineSize, PdfContentByte contentByte,
|
|
13 |
public static void DrawArc(System.Windows.Point p1, System.Windows.Point p2, System.Windows.Point p3, double lineSize, PdfContentByte contentByte,
|
|
14 | 14 |
SolidColorBrush color, double opac) |
15 | 15 |
{ |
16 | 16 |
contentByte.SaveState(); |
... | ... | |
21 | 21 |
BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A); |
22 | 22 |
contentByte.SetColorStroke(bs); |
23 | 23 |
|
24 |
|
|
24 |
lineSize = lineSize * 72 / 96*0.5; |
|
25 | 25 |
contentByte.SetLineWidth((float)lineSize); |
26 |
//contentByte.SetLineWidth((float)lineSize - 2); |
|
27 | 26 |
contentByte.NewPath(); |
28 | 27 |
contentByte.MoveTo((float)p1.X, (float)p1.Y); |
29 | 28 |
|
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/HoneyPDFLib_DrawSet_Cloud.cs | ||
---|---|---|
1 |
using iTextSharp.text; |
|
2 |
using iTextSharp.text.pdf; |
|
3 |
using MarkupToPDF.Controls.Common; |
|
4 |
using System; |
|
5 |
using System.Collections.Generic; |
|
6 |
using System.Linq; |
|
7 |
using System.Text; |
|
8 |
using System.Windows; |
|
9 |
using System.Windows.Media; |
|
10 |
|
|
11 |
namespace MarkupToPDF.Controls_PDF |
|
12 |
{ |
|
13 |
public class DrawSet_Cloud : BaseMethod |
|
14 |
{ |
|
15 |
public static Point nextPoint = new Point(0, 0); |
|
16 |
|
|
17 |
public static double returnAngle(Point start, Point end) |
|
18 |
{ |
|
19 |
double angle = MathSet.getAngle(start.X, start.Y, end.X, end.Y); |
|
20 |
angle += 90; |
|
21 |
|
|
22 |
return angle; |
|
23 |
} |
|
24 |
|
|
25 |
/// <summary> |
|
26 |
/// generate cloud between given p1 and p2 |
|
27 |
/// </summary> |
|
28 |
/// <param name="p1"></param> |
|
29 |
/// <param name="p2"></param> |
|
30 |
/// <param name="arcLengthOrigin"></param> |
|
31 |
/// <param name="contentByte"></param> |
|
32 |
/// <param name="boundAngle"></param> |
|
33 |
/// <param name="fixAngle"></param> |
|
34 |
public static void GenerateLineWithCloud(Point p1, Point p2, double arcLength , PdfContentByte contentByte, double boundAngle, double fixAngle) |
|
35 |
{ |
|
36 |
arcLength = 10; |
|
37 |
double l = MathSet.DistanceTo(p1, p2); /// p1와 p2의 길이 |
|
38 |
arcLength = (l < arcLength) ? l : arcLength; |
|
39 |
double dx = (p2.X - p1.X) / l; |
|
40 |
double dy = (p2.Y - p1.Y) / l; |
|
41 |
Point norm = MathSet.RotateAbout(new Point(0, 0), new Point(dx, dy), 90); |
|
42 |
|
|
43 |
double count = l / arcLength; // 두 선의 길이에서 normalize 된 사이즈만큼을 나눠 진행 수치의 갯수 파악 |
|
44 |
|
|
45 |
Point lastPt = new Point(p1.X, p1.Y); |
|
46 |
Point uses = new Point(0, 0); //사용된 값 누적치 |
|
47 |
uses = lastPt; //Point 첫번째꺼 대입 |
|
48 |
contentByte.MoveTo((float)lastPt.X, (float)lastPt.Y); |
|
49 |
|
|
50 |
for (int j = 0; j < count; j++) //dx , dy의 횟수차로 증감치를 결정 |
|
51 |
{ |
|
52 |
/// update last point |
|
53 |
if (j == count - 1) |
|
54 |
{ |
|
55 |
lastPt.X = p2.X; |
|
56 |
lastPt.Y = p2.Y; |
|
57 |
} |
|
58 |
else |
|
59 |
{ |
|
60 |
lastPt.X = lastPt.X + dx * arcLength; |
|
61 |
lastPt.Y = lastPt.Y + dy * arcLength; /// Y축 반전 |
|
62 |
} |
|
63 |
|
|
64 |
var midP = MathSet.getMiddlePoint(uses, lastPt); //시작점과 끝점의 중간점 |
|
65 |
contentByte.CurveTo((float)uses.X, (float)uses.Y, (float)midP.X - norm.X * arcLength*0.3, (float)midP.Y - norm.Y*arcLength*0.3, (float)lastPt.X, (float)lastPt.Y); |
|
66 |
uses.X = lastPt.X; |
|
67 |
uses.Y = lastPt.Y; |
|
68 |
} |
|
69 |
|
|
70 |
l = MathSet.DistanceTo(uses, p2); /// 남은 거리 계산 |
|
71 |
if (l > 0) |
|
72 |
{ |
|
73 |
var midP = MathSet.getMiddlePoint(uses, p2); //시작점과 끝점의 중간점 |
|
74 |
contentByte.CurveTo((float)uses.X, (float)uses.Y, (float)midP.X - norm.X * l*0.3, (float)midP.Y - norm.Y*l*0.3, (float)p2.X, (float)p2.Y); |
|
75 |
} |
|
76 |
} |
|
77 |
|
|
78 |
public static void GenerateLineWithCloud_Closing(Point p1, Point p2, double arcLengthOrigin, PdfContentByte contentByte, double boundAngle) |
|
79 |
{ |
|
80 |
contentByte.MoveTo((float)p1.X, (float)p1.Y); |
|
81 |
double l = MathSet.DistanceTo(p1, p2); /// p1와 p2의 길이 |
|
82 |
var midP = MathSet.getMiddlePoint(p1, p2); //시작점과 끝점의 중간점 |
|
83 |
var endP = MathSet.RotateAbout(midP, new Point(midP.X + (l / 2), midP.Y), boundAngle); //중간점을 계산된 각도로 돌림(반시계) |
|
84 |
contentByte.CurveTo((float)p1.X, (float)p1.Y, (float)endP.X, (float)endP.Y, (float)p2.X, (float)p2.Y); |
|
85 |
} |
|
86 |
|
|
87 |
public static void DrawCloud(List<Point> points, double lineSize, double arcLength, PdfContentByte contentByte, System.Windows.Media.DoubleCollection DashSize, |
|
88 |
SolidColorBrush color, PaintSet PaintStyle, bool NotEofFill, bool reverseAngle, bool isHighlight, double opac) |
|
89 |
{ |
|
90 |
double fixAngle = 0; |
|
91 |
if (reverseAngle) |
|
92 |
{ |
|
93 |
fixAngle = 180; |
|
94 |
} |
|
95 |
BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A); |
|
96 |
contentByte.SaveState(); |
|
97 |
|
|
98 |
PdfGState gs1 = new PdfGState(); |
|
99 |
gs1.StrokeOpacity = (float)opac; |
|
100 |
gs1.FillOpacity = (float)opac; |
|
101 |
contentByte.SetGState(gs1); |
|
102 |
var rect = contentByte.PdfDocument.PageSize; |
|
103 |
if (isHighlight) |
|
104 |
{ |
|
105 |
contentByte.SetColorFill(BaseColor.YELLOW); |
|
106 |
} |
|
107 |
else |
|
108 |
{ |
|
109 |
contentByte.SetColorStroke(bs); |
|
110 |
} |
|
111 |
List<float> DashSet = new List<float>(); |
|
112 |
|
|
113 |
/// WPF defines a device-independent pixel as 1 / 96 per inch |
|
114 |
/// iTextSharp : "the default for the size of the unit in default user space (1/72 inch) |
|
115 |
lineSize = lineSize * 72 / 96*0.5; |
|
116 |
|
|
117 |
DashSize.ToList().ForEach(data => DashSet.Add((float)data * 2)); |
|
118 |
contentByte.SetLineDash(DashSet.ToArray(), DashSet.Count - 2); |
|
119 |
contentByte.SetLineWidth((float)lineSize); |
|
120 |
|
|
121 |
var getMidSet = MathSet.FindCentroid(points); |
|
122 |
contentByte.NewPath(); |
|
123 |
double area = MathSet.AreaOf(points); |
|
124 |
if(area < 0) points.Reverse(); |
|
125 |
int count = points.Count; |
|
126 |
double angle = 0; |
|
127 |
for (int i = 0; i < count - 1; i++) //테스트로 하나만 |
|
128 |
{ |
|
129 |
angle = returnAngle(points[i], points[i + 1]) + fixAngle; |
|
130 |
GenerateLineWithCloud(points[i], points[i + 1], arcLength, contentByte, angle, fixAngle); |
|
131 |
} |
|
132 |
|
|
133 |
angle = returnAngle(points[points.Count - 1], points[0]) + fixAngle; |
|
134 |
GenerateLineWithCloud(points[points.Count - 1], points[0], arcLength, contentByte, angle, fixAngle); |
|
135 |
|
|
136 |
switch (PaintStyle) |
|
137 |
{ |
|
138 |
case PaintSet.Fill: |
|
139 |
HoneyPDFLib_DrawSet_Shape.PaintFill(contentByte, PaintStyle, bs); |
|
140 |
break; |
|
141 |
case PaintSet.Hatch: |
|
142 |
{ |
|
143 |
PdfPatternPainter line = contentByte.CreatePattern(6, 6, 4, 4, bs); |
|
144 |
line.SetLineWidth(1); |
|
145 |
line.MoveTo(0, 0); |
|
146 |
line.LineTo(100, 100); |
|
147 |
line.Stroke(); |
|
148 |
PatternColor colors = new PatternColor(line); |
|
149 |
contentByte.SetColorFill(colors); |
|
150 |
contentByte.ClosePath(); |
|
151 |
contentByte.Fill(); |
|
152 |
DrawCloud(points, lineSize, arcLength, contentByte, DashSize, color, PaintSet.None, true, reverseAngle, false, opac); |
|
153 |
} |
|
154 |
break; |
|
155 |
case PaintSet.None: |
|
156 |
{ |
|
157 |
contentByte.Stroke(); |
|
158 |
} |
|
159 |
break; |
|
160 |
default: |
|
161 |
break; |
|
162 |
} |
|
163 |
contentByte.RestoreState(); |
|
164 |
} |
|
165 |
} |
|
166 |
} |
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/HoneyPDFLib_DrawSet_DrawString.cs | ||
---|---|---|
239 | 239 |
} |
240 | 240 |
|
241 | 241 |
public static void DrawString(Point sp, Point ep, double lineSize, iTextSharp.text.pdf.PdfContentByte contentByte, SolidColorBrush color, PaintSet PaintStyle, double FontSize, |
242 |
bool isHighlight, FontFamily fontFamilly, FontStyle fontstyle, FontWeight fontweight, TextDecorationCollection isUnderline,
|
|
242 |
FontFamily fontFamilly, FontStyle fontstyle, FontWeight fontweight, TextDecorationCollection isUnderline, |
|
243 | 243 |
string text, System.Drawing.SizeF size, double opac, double Angle) |
244 | 244 |
{ |
245 | 245 |
BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A); |
... | ... | |
252 | 252 |
point.Add(rect.BottomRight); |
253 | 253 |
point.Add(rect.TopRight); |
254 | 254 |
|
255 |
//lineSize = 1; |
|
256 | 255 |
var calRect = MathSet.GetPointsToRectX(point); |
257 | 256 |
lineSize = lineSize * 72 / 96*0.5; |
258 | 257 |
contentByte.SetLineWidth((float)lineSize); |
259 | 258 |
|
260 | 259 |
switch (PaintStyle) |
261 | 260 |
{ |
261 |
case PaintSet.HIGHLIGHT: |
|
262 | 262 |
case PaintSet.Fill: //Border |
263 | 263 |
{ |
264 | 264 |
PdfGState gs1 = new PdfGState(); |
265 | 265 |
gs1.FillOpacity = 0.7f; |
266 | 266 |
gs1.StrokeOpacity = (float)opac; |
267 |
if (isHighlight)
|
|
267 |
if (PaintStyle == PaintSet.HIGHLIGHT)
|
|
268 | 268 |
{ |
269 | 269 |
contentByte.SetColorFill(BaseColor.YELLOW); |
270 | 270 |
} |
... | ... | |
288 | 288 |
break; |
289 | 289 |
case PaintSet.Hatch: //Hatch |
290 | 290 |
{ |
291 |
double ArcLength = 30; |
|
292 |
double distance = MathSet.DistanceTo(sp, ep); |
|
293 |
ArcLength = (distance * 0.4); |
|
294 |
if (ArcLength <= 10) |
|
295 |
{ |
|
296 |
ArcLength = 10; |
|
297 |
} |
|
298 |
else if (ArcLength >= 30) |
|
299 |
{ |
|
300 |
ArcLength = 30; |
|
301 |
} |
|
291 |
double ArcLength = 10; /// default arc length |
|
302 | 292 |
|
303 |
DrawSet_Cloud.DrawCloud(point, lineSize, ArcLength, contentByte, new DoubleCollection(99999), color, PaintSet.None, |
|
304 |
false, false, isHighlight, opac); |
|
293 |
DrawSet_Cloud.DrawCloud(point, lineSize, ArcLength, contentByte, new DoubleCollection(99999), color, PaintSet.None, opac); |
|
305 | 294 |
|
306 |
contentByte.ClosePath(); |
|
295 |
contentByte.ClosePath(); ///TODO: check this is need
|
|
307 | 296 |
contentByte.RestoreState(); |
308 | 297 |
contentByte.SaveState(); |
309 | 298 |
} |
310 | 299 |
break; |
311 | 300 |
case PaintSet.None: |
312 |
{ |
|
313 |
PdfGState gs1 = new PdfGState(); |
|
314 |
if (opac == 1.0f) |
|
315 |
{ |
|
316 |
gs1.FillOpacity = 0.7f; |
|
317 |
} |
|
318 |
else |
|
319 |
{ |
|
320 |
|
|
321 |
gs1.FillOpacity = (float)0.3; |
|
322 |
} |
|
323 |
gs1.StrokeOpacity = (float)opac; |
|
324 |
|
|
325 |
if (isHighlight) |
|
326 |
{ |
|
327 |
contentByte.SetColorFill(BaseColor.YELLOW); |
|
328 |
} |
|
329 |
else |
|
330 |
{ |
|
331 |
contentByte.SetColorFill(BaseColor.WHITE); |
|
332 |
} |
|
333 |
|
|
334 |
contentByte.SetColorStroke(bs); |
|
335 |
contentByte.SetGState(gs1); |
|
336 |
contentByte.NewPath(); |
|
337 |
|
|
338 |
contentByte.Rectangle((float)calRect.Left, (float)calRect.Bottom, (float)calRect.Width, (float)calRect.Height); |
|
339 |
contentByte.ClosePath(); |
|
340 |
System.Drawing.Drawing2D.Matrix mat2 = new System.Drawing.Drawing2D.Matrix(); |
|
341 |
mat2.RotateAt((float)Angle * -1, new System.Drawing.PointF((float)sp.X, (float)sp.Y)); |
|
342 |
contentByte.Transform(mat2); |
|
343 |
contentByte.Fill(); |
|
344 |
contentByte.RestoreState(); |
|
345 |
contentByte.SaveState(); |
|
346 |
} |
|
301 |
/// do nothing |
|
347 | 302 |
break; |
348 | 303 |
default: |
349 | 304 |
break; |
... | ... | |
356 | 311 |
string ARIALUNI_TFF = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "Arial Unicode MS.TTF"); |
357 | 312 |
//string ARIALUNI_TFF = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "Arial"); |
358 | 313 |
|
359 |
|
|
360 |
|
|
361 | 314 |
//나눔폰트가 항상 있어야 함 |
362 | 315 |
|
363 | 316 |
|
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/HoneyPDFLib_DrawSet_Shape.cs | ||
---|---|---|
150 | 150 |
PaintFill(contentByte, PaintStyle, bs); |
151 | 151 |
contentByte.RestoreState(); |
152 | 152 |
} |
153 |
|
|
153 | 154 |
public static void PaintFill(PdfContentByte contentByte, PaintSet PaintStyle, BaseColor bs) |
154 | 155 |
{ |
155 | 156 |
switch (PaintStyle) |
156 | 157 |
{ |
158 |
case PaintSet.HIGHLIGHT: |
|
159 |
{ |
|
160 |
contentByte.SetColorFill(bs); |
|
161 |
contentByte.ClosePathFillStroke(); |
|
162 |
} |
|
163 |
break; |
|
157 | 164 |
case PaintSet.Fill: |
158 | 165 |
{ |
159 | 166 |
contentByte.SetColorFill(bs); |
FinalService/KCOM_FinalService/MarkupToPDF/MarkupToPDF.cs | ||
---|---|---|
736 | 736 |
bool reverse = (area < 0); |
737 | 737 |
if (PaintStyle == PaintSet.None) |
738 | 738 |
{ |
739 |
Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, PaintStyle, true, !reverse, false, Opacity);
|
|
739 |
Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, PaintStyle, Opacity); |
|
740 | 740 |
} |
741 | 741 |
else |
742 | 742 |
{ |
743 |
Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, PaintStyle, false, !reverse, false, Opacity);
|
|
743 |
Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, PaintStyle, Opacity); |
|
744 | 744 |
} |
745 | 745 |
} |
746 | 746 |
break; |
... | ... | |
774 | 774 |
|
775 | 775 |
if (PaintStyle == PaintSet.None) |
776 | 776 |
{ |
777 |
Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, PaintStyle, true, !reverse, false, Opacity);
|
|
777 |
Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, PaintStyle, Opacity); |
|
778 | 778 |
} |
779 | 779 |
else |
780 | 780 |
{ |
781 |
Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, PaintStyle, false, !reverse, false, Opacity);
|
|
781 |
Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, PaintStyle, Opacity); |
|
782 | 782 |
} |
783 | 783 |
} |
784 | 784 |
else |
... | ... | |
823 | 823 |
default: |
824 | 824 |
break; |
825 | 825 |
} |
826 |
if (control.isHighLight) paint = PaintSet.HIGHLIGHT; |
|
826 | 827 |
|
827 | 828 |
double LineSize = Convert.ToDouble(data2.First()); |
828 | 829 |
double TextSize = Convert.ToDouble(data2[1]); |
829 | 830 |
SolidColorBrush FontColor = _SetColor; |
830 |
bool isHighlight = control.isHighLight; |
|
831 | 831 |
double Angle = control.Angle; |
832 | 832 |
double Opacity = control.Opac; |
833 | 833 |
FontFamily fontfamilly = new FontFamily(control.fontConfig[0]); |
... | ... | |
860 | 860 |
LineSize = 3; |
861 | 861 |
} |
862 | 862 |
|
863 |
Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString(StartPoint, EndPoint, LineSize, contentByte, _SetColor, paint, TextSize, isHighlight, fontfamilly, fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
|
|
863 |
Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString(StartPoint, EndPoint, LineSize, contentByte, _SetColor, paint, TextSize, fontfamilly, fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle); |
|
864 | 864 |
} |
865 | 865 |
break; |
866 | 866 |
#endregion |
FinalService/KCOM_FinalService/MarkupToPDF/MarkupToPDF.csproj | ||
---|---|---|
139 | 139 |
<Compile Include="Controls\Text\ArrowTextControl.cs" /> |
140 | 140 |
<Compile Include="Controls\Text\TextControl.cs" /> |
141 | 141 |
<Compile Include="Controls_PDF\BaseMethod.cs" /> |
142 |
<Compile Include="Controls_PDF\DrawSet_Cloud.cs" /> |
|
142 | 143 |
<Compile Include="Controls_PDF\DrawSet_Symbol.cs" /> |
143 | 144 |
<Compile Include="Controls_PDF\HoneyPDFLib_DrawSet_Arc.cs" /> |
144 | 145 |
<Compile Include="Controls_PDF\HoneyPDFLib_DrawSet_Arrow.cs" /> |
145 |
<Compile Include="Controls_PDF\HoneyPDFLib_DrawSet_Cloud.cs" /> |
|
146 | 146 |
<Compile Include="Controls_PDF\HoneyPDFLib_DrawSet_DrawString.cs" /> |
147 | 147 |
<Compile Include="Controls_PDF\HoneyPDFLib_DrawSet_Image.cs" /> |
148 | 148 |
<Compile Include="Controls_PDF\HoneyPDFLib_DrawSet_Line.cs" /> |
내보내기 Unified diff