개정판 16fe076c
issue #1220: 직선 클라우드 텍스트 생성 오류 수정
Change-Id: I82c73beb57d1ebc3f972fea27e5a62c84aed1196
FinalService/KCOM_FinalService/FinalService_Config/App.config | ||
---|---|---|
3 | 3 |
<startup> |
4 | 4 |
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> |
5 | 5 |
</startup> |
6 |
|
|
7 |
<connectionStrings> |
|
8 |
<add name="ConnectionString" connectionString="metadata=res://*/DataModel.KCOM_Model.csdl|res://*/DataModel.KCOM_Model.ssdl|res://*/DataModel.KCOM_Model.msl;provider=System.Data.SqlClient;provider=System.Data.SqlClient;provider connection string="data source=cloud.devdoftech.co.kr,7777;initial catalog=markus;persist security info=True;user id=doftech;password=dof1073#;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient"/> |
|
9 |
<add name="CIConnectionString" connectionString="metadata=res://*/DataModel.CIModel.csdl|res://*/DataModel.CIModel.ssdl|res://*/DataModel.CIModel.msl;provider=System.Data.SqlClient;provider=System.Data.SqlClient;provider connection string="data source=cloud.devdoftech.co.kr,7777;initial catalog=markus;persist security info=True;user id=doftech;password=dof1073#;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient"/> |
|
10 |
</connectionStrings> |
|
6 | 11 |
</configuration> |
FinalService/KCOM_FinalService/FinalService_Config/FinalService_Config.csproj | ||
---|---|---|
33 | 33 |
</PropertyGroup> |
34 | 34 |
<ItemGroup> |
35 | 35 |
<Reference Include="System" /> |
36 |
<Reference Include="System.Configuration" /> |
|
36 | 37 |
<Reference Include="System.Core" /> |
38 |
<Reference Include="System.Data.Entity" /> |
|
37 | 39 |
<Reference Include="System.Runtime.Remoting" /> |
38 | 40 |
<Reference Include="System.Xml.Linq" /> |
39 | 41 |
<Reference Include="System.Data.DataSetExtensions" /> |
... | ... | |
60 | 62 |
<EmbeddedResource Include="FormConfig.resx"> |
61 | 63 |
<DependentUpon>FormConfig.cs</DependentUpon> |
62 | 64 |
</EmbeddedResource> |
63 |
<EmbeddedResource Include="Properties\licenses.licx" /> |
|
64 | 65 |
<EmbeddedResource Include="Properties\Resources.resx"> |
65 | 66 |
<Generator>ResXFileCodeGenerator</Generator> |
66 | 67 |
<LastGenOutput>Resources.Designer.cs</LastGenOutput> |
... | ... | |
85 | 86 |
<None Include="App.config" /> |
86 | 87 |
</ItemGroup> |
87 | 88 |
<ItemGroup> |
89 |
<ProjectReference Include="..\CommonLib\CommonLib.csproj"> |
|
90 |
<Project>{ee9aaabc-1678-43a4-878e-cedbb577cf01}</Project> |
|
91 |
<Name>CommonLib</Name> |
|
92 |
</ProjectReference> |
|
88 | 93 |
<ProjectReference Include="..\IFinalPDF\IFinalPDF.csproj"> |
89 | 94 |
<Project>{784438be-2074-41ae-a692-24e1a4a67fe3}</Project> |
90 | 95 |
<Name>IFinalPDF</Name> |
FinalService/KCOM_FinalService/FinalService_Config/FormConfig.Designer.cs | ||
---|---|---|
32 | 32 |
this.textBoxLog = new System.Windows.Forms.TextBox(); |
33 | 33 |
this.label1 = new System.Windows.Forms.Label(); |
34 | 34 |
this.textBoxPort = new System.Windows.Forms.TextBox(); |
35 |
this.label2 = new System.Windows.Forms.Label(); |
|
36 |
this.textBoxProjectNO = new System.Windows.Forms.TextBox(); |
|
37 |
this.label3 = new System.Windows.Forms.Label(); |
|
38 |
this.textBoxDocumentID = new System.Windows.Forms.TextBox(); |
|
35 | 39 |
this.SuspendLayout(); |
36 | 40 |
// |
37 | 41 |
// buttonTest |
38 | 42 |
// |
39 |
this.buttonTest.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) |
|
40 |
| System.Windows.Forms.AnchorStyles.Right))); |
|
41 |
this.buttonTest.Location = new System.Drawing.Point(0, 33); |
|
43 |
this.buttonTest.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); |
|
44 |
this.buttonTest.Location = new System.Drawing.Point(602, 30); |
|
42 | 45 |
this.buttonTest.Name = "buttonTest"; |
43 |
this.buttonTest.Size = new System.Drawing.Size(417, 49);
|
|
46 |
this.buttonTest.Size = new System.Drawing.Size(174, 21);
|
|
44 | 47 |
this.buttonTest.TabIndex = 0; |
45 | 48 |
this.buttonTest.Text = "파이널 서비스 호출"; |
46 | 49 |
this.buttonTest.UseVisualStyleBackColor = true; |
... | ... | |
51 | 54 |
this.textBoxLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
52 | 55 |
| System.Windows.Forms.AnchorStyles.Left) |
53 | 56 |
| System.Windows.Forms.AnchorStyles.Right))); |
54 |
this.textBoxLog.Location = new System.Drawing.Point(0, 88);
|
|
57 |
this.textBoxLog.Location = new System.Drawing.Point(0, 57);
|
|
55 | 58 |
this.textBoxLog.Multiline = true; |
56 | 59 |
this.textBoxLog.Name = "textBoxLog"; |
57 |
this.textBoxLog.Size = new System.Drawing.Size(417, 90);
|
|
60 |
this.textBoxLog.Size = new System.Drawing.Size(789, 461);
|
|
58 | 61 |
this.textBoxLog.TabIndex = 1; |
59 | 62 |
// |
60 | 63 |
// label1 |
... | ... | |
68 | 71 |
// |
69 | 72 |
// textBoxPort |
70 | 73 |
// |
71 |
this.textBoxPort.Location = new System.Drawing.Point(59, 6);
|
|
74 |
this.textBoxPort.Location = new System.Drawing.Point(112, 3);
|
|
72 | 75 |
this.textBoxPort.Name = "textBoxPort"; |
73 | 76 |
this.textBoxPort.Size = new System.Drawing.Size(100, 21); |
74 | 77 |
this.textBoxPort.TabIndex = 3; |
75 | 78 |
this.textBoxPort.Text = "9092"; |
76 | 79 |
// |
80 |
// label2 |
|
81 |
// |
|
82 |
this.label2.AutoSize = true; |
|
83 |
this.label2.Location = new System.Drawing.Point(12, 33); |
|
84 |
this.label2.Name = "label2"; |
|
85 |
this.label2.Size = new System.Drawing.Size(93, 12); |
|
86 |
this.label2.TabIndex = 4; |
|
87 |
this.label2.Text = "프로젝트 번호 : "; |
|
88 |
// |
|
89 |
// textBoxProjectNO |
|
90 |
// |
|
91 |
this.textBoxProjectNO.Location = new System.Drawing.Point(112, 30); |
|
92 |
this.textBoxProjectNO.Name = "textBoxProjectNO"; |
|
93 |
this.textBoxProjectNO.Size = new System.Drawing.Size(100, 21); |
|
94 |
this.textBoxProjectNO.TabIndex = 5; |
|
95 |
// |
|
96 |
// label3 |
|
97 |
// |
|
98 |
this.label3.AutoSize = true; |
|
99 |
this.label3.Location = new System.Drawing.Point(218, 33); |
|
100 |
this.label3.Name = "label3"; |
|
101 |
this.label3.Size = new System.Drawing.Size(56, 12); |
|
102 |
this.label3.TabIndex = 6; |
|
103 |
this.label3.Text = "문서 ID : "; |
|
104 |
// |
|
105 |
// textBoxDocumentID |
|
106 |
// |
|
107 |
this.textBoxDocumentID.Location = new System.Drawing.Point(280, 30); |
|
108 |
this.textBoxDocumentID.Name = "textBoxDocumentID"; |
|
109 |
this.textBoxDocumentID.Size = new System.Drawing.Size(316, 21); |
|
110 |
this.textBoxDocumentID.TabIndex = 7; |
|
111 |
// |
|
77 | 112 |
// FormConfig |
78 | 113 |
// |
79 | 114 |
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); |
80 | 115 |
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
81 |
this.ClientSize = new System.Drawing.Size(416, 190); |
|
116 |
this.ClientSize = new System.Drawing.Size(788, 530); |
|
117 |
this.Controls.Add(this.textBoxDocumentID); |
|
118 |
this.Controls.Add(this.label3); |
|
119 |
this.Controls.Add(this.textBoxProjectNO); |
|
120 |
this.Controls.Add(this.label2); |
|
82 | 121 |
this.Controls.Add(this.textBoxPort); |
83 | 122 |
this.Controls.Add(this.label1); |
84 | 123 |
this.Controls.Add(this.textBoxLog); |
... | ... | |
96 | 135 |
private System.Windows.Forms.TextBox textBoxLog; |
97 | 136 |
private System.Windows.Forms.Label label1; |
98 | 137 |
private System.Windows.Forms.TextBox textBoxPort; |
138 |
private System.Windows.Forms.Label label2; |
|
139 |
private System.Windows.Forms.TextBox textBoxProjectNO; |
|
140 |
private System.Windows.Forms.Label label3; |
|
141 |
private System.Windows.Forms.TextBox textBoxDocumentID; |
|
99 | 142 |
} |
100 | 143 |
} |
101 | 144 |
|
FinalService/KCOM_FinalService/FinalService_Config/FormConfig.cs | ||
---|---|---|
9 | 9 |
using System.Threading.Tasks; |
10 | 10 |
using System.Windows.Forms; |
11 | 11 |
using System.Runtime.Remoting.Channels.Tcp; |
12 |
using System.Configuration; |
|
12 | 13 |
using IFinalPDF; |
13 | 14 |
|
14 | 15 |
namespace FinalService_Config |
... | ... | |
25 | 26 |
FinalPDFResult result = new FinalPDFResult(); |
26 | 27 |
RemFinalPDFObject remObj = null; |
27 | 28 |
|
28 |
string ChannelID; |
|
29 |
FINAL_PDF pdfData = new FINAL_PDF(); |
|
30 |
System.Runtime.Remoting.Channels.IChannel _ch = System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp"); |
|
31 |
if (_ch == null) |
|
32 |
{ |
|
33 |
TcpChannel chan = new TcpChannel(); |
|
34 |
ChannelID = chan.ChannelName; |
|
35 |
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(chan, false); |
|
36 |
// Create an instance of the remote object |
|
37 |
} |
|
38 |
else |
|
29 |
try |
|
39 | 30 |
{ |
40 |
ChannelID = _ch.ChannelName; |
|
41 |
} |
|
31 |
string ChannelID; |
|
32 |
FINAL_PDF pdfData = new FINAL_PDF(); |
|
33 |
System.Runtime.Remoting.Channels.IChannel _ch = System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp"); |
|
34 |
if (_ch == null) |
|
35 |
{ |
|
36 |
TcpChannel chan = new TcpChannel(); |
|
37 |
ChannelID = chan.ChannelName; |
|
38 |
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(chan, false); |
|
39 |
// Create an instance of the remote object |
|
40 |
} |
|
41 |
else |
|
42 |
{ |
|
43 |
ChannelID = _ch.ChannelName; |
|
44 |
} |
|
42 | 45 |
|
43 |
remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject), |
|
44 |
string.Format("tcp://localhost:{0}/remFinalPDF", this.textBoxPort.Text)); |
|
46 |
remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject),
|
|
47 |
string.Format("tcp://localhost:{0}/remFinalPDF", this.textBoxPort.Text));
|
|
45 | 48 |
|
46 |
try |
|
47 |
{ |
|
48 |
result = remObj.SetFinalPDF("000000", "111111"); |
|
49 |
result.FinalID = ShortGuid(); |
|
50 |
result.Status = FinalStatus.Success; |
|
49 |
try |
|
50 |
{ |
|
51 |
result = remObj.SetFinalPDF(this.textBoxProjectNO.Text, this.textBoxDocumentID.Text); |
|
52 |
result.FinalID = ShortGuid(); |
|
53 |
result.Status = FinalStatus.Success; |
|
54 |
} |
|
55 |
catch (Exception ex) |
|
56 |
{ |
|
57 |
this.textBoxLog.Text = ex.StackTrace.ToString(); |
|
58 |
} |
|
51 | 59 |
} |
52 | 60 |
catch(Exception ex) |
53 | 61 |
{ |
FinalService/KCOM_FinalService/FinalService_Config/Properties/licenses.licx | ||
---|---|---|
1 |
Telerik.WinControls.UI.RadWaitingBar, Telerik.WinControls.UI, Version=2018.2.621.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e |
FinalService/KCOM_FinalService/KCOM_FinalService.sln | ||
---|---|---|
11 | 11 |
EndProject |
12 | 12 |
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KCOMDataModel", "KCOMDataModel\KCOMDataModel.csproj", "{629DC8CD-D458-47EF-8F02-CD12C7001C3E}" |
13 | 13 |
EndProject |
14 |
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{2068A2DC-AEAD-4473-8C97-CA7370A12E64}" |
|
15 |
EndProject |
|
16 | 14 |
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IFinalPDF", "IFinalPDF\IFinalPDF.csproj", "{784438BE-2074-41AE-A692-24E1A4A67FE3}" |
17 | 15 |
EndProject |
18 | 16 |
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MarkupToPDF", "MarkupToPDF\MarkupToPDF.csproj", "{A714BD67-8AAC-4ED8-8ECF-7853C3549A68}" |
... | ... | |
63 | 61 |
{629DC8CD-D458-47EF-8F02-CD12C7001C3E}.Release|x64.Build.0 = Release|Any CPU |
64 | 62 |
{629DC8CD-D458-47EF-8F02-CD12C7001C3E}.Release|x86.ActiveCfg = Release|Any CPU |
65 | 63 |
{629DC8CD-D458-47EF-8F02-CD12C7001C3E}.Release|x86.Build.0 = Release|Any CPU |
66 |
{2068A2DC-AEAD-4473-8C97-CA7370A12E64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
67 |
{2068A2DC-AEAD-4473-8C97-CA7370A12E64}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
68 |
{2068A2DC-AEAD-4473-8C97-CA7370A12E64}.Debug|x64.ActiveCfg = Debug|Any CPU |
|
69 |
{2068A2DC-AEAD-4473-8C97-CA7370A12E64}.Debug|x64.Build.0 = Debug|Any CPU |
|
70 |
{2068A2DC-AEAD-4473-8C97-CA7370A12E64}.Debug|x86.ActiveCfg = Debug|Any CPU |
|
71 |
{2068A2DC-AEAD-4473-8C97-CA7370A12E64}.Debug|x86.Build.0 = Debug|Any CPU |
|
72 |
{2068A2DC-AEAD-4473-8C97-CA7370A12E64}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
73 |
{2068A2DC-AEAD-4473-8C97-CA7370A12E64}.Release|Any CPU.Build.0 = Release|Any CPU |
|
74 |
{2068A2DC-AEAD-4473-8C97-CA7370A12E64}.Release|x64.ActiveCfg = Release|Any CPU |
|
75 |
{2068A2DC-AEAD-4473-8C97-CA7370A12E64}.Release|x64.Build.0 = Release|Any CPU |
|
76 |
{2068A2DC-AEAD-4473-8C97-CA7370A12E64}.Release|x86.ActiveCfg = Release|Any CPU |
|
77 |
{2068A2DC-AEAD-4473-8C97-CA7370A12E64}.Release|x86.Build.0 = Release|Any CPU |
|
78 | 64 |
{784438BE-2074-41AE-A692-24E1A4A67FE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
79 | 65 |
{784438BE-2074-41AE-A692-24E1A4A67FE3}.Debug|Any CPU.Build.0 = Debug|Any CPU |
80 | 66 |
{784438BE-2074-41AE-A692-24E1A4A67FE3}.Debug|x64.ActiveCfg = Debug|Any CPU |
FinalService/KCOM_FinalService/KCOM_FinalService/Common/ServiceEventLog.cs | ||
---|---|---|
16 | 16 |
this.Source = SourceName; |
17 | 17 |
this.Log = LogName; |
18 | 18 |
|
19 |
//if (!EventLog.SourceExists(SourceName)) |
|
20 |
// EventLog.CreateEventSource(SourceName, "Application"); |
|
19 |
if (!Environment.UserInteractive) |
|
20 |
{ |
|
21 |
if (!EventLog.SourceExists(SourceName)) |
|
22 |
EventLog.CreateEventSource(SourceName, "Application"); |
|
23 |
} |
|
21 | 24 |
} |
22 | 25 |
|
23 | 26 |
public void Write(string Message) |
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/DrawSet_Arc.cs | ||
---|---|---|
1 |
using iTextSharp.text; |
|
2 |
using iTextSharp.text.pdf; |
|
3 |
using System; |
|
4 |
using System.Collections.Generic; |
|
5 |
using System.Linq; |
|
6 |
using System.Text; |
|
7 |
using System.Windows.Media; |
|
8 |
|
|
9 |
namespace MarkupToPDF.Controls_PDF |
|
10 |
{ |
|
11 |
public class DrawSet_Arc : BaseMethod |
|
12 |
{ |
|
13 |
public static void DrawArc(System.Windows.Point p1, System.Windows.Point p2, System.Windows.Point p3, int lineSize, PdfContentByte contentByte, |
|
14 |
SolidColorBrush color, double opac) |
|
15 |
{ |
|
16 |
contentByte.SaveState(); |
|
17 |
PdfGState gs1 = new PdfGState(); |
|
18 |
gs1.StrokeOpacity = (float)opac; |
|
19 |
contentByte.SetGState(gs1); |
|
20 |
var rect = contentByte.PdfDocument.PageSize; |
|
21 |
BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A); |
|
22 |
contentByte.SetColorStroke(bs); |
|
23 |
|
|
24 |
contentByte.SetLineWidth((float)lineSize); |
|
25 |
contentByte.NewPath(); |
|
26 |
contentByte.MoveTo((float)p1.X, (float)p1.Y); |
|
27 |
|
|
28 |
if (p2.Y >= p1.Y || p2.Y >= p3.Y) //중간 Mid Point 는 Curve 특성에 대한 10 범위 내의 오차 적용 |
|
29 |
{ |
|
30 |
contentByte.CurveTo((float)p1.X, (float)p1.Y, (float)p2.X, (float)p2.Y + 10, (float)p3.X, (float)p3.Y); |
|
31 |
} |
|
32 |
else |
|
33 |
{ |
|
34 |
contentByte.CurveTo((float)p1.X, (float)p1.Y, (float)p2.X, (float)p2.Y - 10, (float)p3.X, (float)p3.Y); |
|
35 |
} |
|
36 |
|
|
37 |
contentByte.Stroke(); |
|
38 |
contentByte.ClosePath(); |
|
39 |
contentByte.RestoreState(); |
|
40 |
} |
|
41 |
} |
|
42 |
} |
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/DrawSet_Arrow.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_Arrow : BaseMethod |
|
14 |
{ |
|
15 |
public static void SingleAllow(System.Windows.Point p1, System.Windows.Point p2, double lineSize, PdfContentByte contentByte, |
|
16 |
SolidColorBrush color, double opac, bool isFixPoint = false) |
|
17 |
{ |
|
18 |
contentByte.SaveState(); |
|
19 |
{ |
|
20 |
PdfGState gs1 = new PdfGState(); |
|
21 |
gs1.StrokeOpacity = (float)opac; |
|
22 |
contentByte.SetGState(gs1); |
|
23 |
var rect = contentByte.PdfDocument.PageSize; |
|
24 |
BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A); |
|
25 |
contentByte.SetColorFill(bs); |
|
26 |
contentByte.SetColorStroke(bs); |
|
27 |
contentByte.SetLineWidth(lineSize); |
|
28 |
|
|
29 |
double l = MathSet.DistanceTo(p1, p2); |
|
30 |
double dx = (p1.X - p2.X) / l; |
|
31 |
double dy = (p1.Y - p2.Y) / l; |
|
32 |
Point norm = MathSet.RotateAbout(new Point(0, 0), new Point(dx, dy), 90); |
|
33 |
|
|
34 |
contentByte.NewPath(); |
|
35 |
|
|
36 |
lineSize = lineSize < 0.3 ? 0.3 : lineSize; |
|
37 |
contentByte.MoveTo(p1.X - dx * 3*lineSize - norm.X * 1*lineSize, p1.Y - dy * 3*lineSize - norm.Y * 1*lineSize); |
|
38 |
contentByte.LineTo(p1.X - dx * 3*lineSize + norm.X * 1*lineSize, p1.Y - dy * 3*lineSize + norm.Y * 1*lineSize); |
|
39 |
contentByte.LineTo(p1.X, p1.Y); |
|
40 |
contentByte.LineTo(p1.X - dx * 3*lineSize - norm.X * 1*lineSize, p1.Y - dy * 3*lineSize - norm.Y * 1*lineSize); |
|
41 |
|
|
42 |
contentByte.ClosePathFillStroke(); |
|
43 |
} |
|
44 |
contentByte.RestoreState(); |
|
45 |
} |
|
46 |
|
|
47 |
public static void DimAllow(System.Windows.Point p1, System.Windows.Point p2, double lineSize, PdfContentByte contentByte, |
|
48 |
SolidColorBrush color, double opac, bool isFixPoint = false) |
|
49 |
{ |
|
50 |
contentByte.SaveState(); |
|
51 |
PdfGState gs1 = new PdfGState(); |
|
52 |
gs1.StrokeOpacity = (float)opac; |
|
53 |
contentByte.SetGState(gs1); |
|
54 |
var rect = contentByte.PdfDocument.PageSize; |
|
55 |
BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A); |
|
56 |
contentByte.SetColorFill(bs); |
|
57 |
contentByte.SetColorStroke(bs); |
|
58 |
//contentByte.SetLineWidth((float)lineSize - 2); |
|
59 |
contentByte.SetLineWidth((float)lineSize); |
|
60 |
|
|
61 |
double theta = Math.Atan2((p2.Y - p1.Y), (p2.X - p1.X)) * 180 / Math.PI; |
|
62 |
|
|
63 |
//iTextSharp.awt.geom.Point startPoint_p1 = new iTextSharp.awt.geom.Point(p1.X - lineSize, p1.Y - lineSize * 2); |
|
64 |
//iTextSharp.awt.geom.Point endPoint_p1 = new iTextSharp.awt.geom.Point(p1.X - lineSize, p1.Y + lineSize * 2); |
|
65 |
|
|
66 |
//iTextSharp.awt.geom.Point startPoint_p2 = new iTextSharp.awt.geom.Point(p2.X + lineSize, p2.Y - lineSize * 2); |
|
67 |
//iTextSharp.awt.geom.Point endPoint_p2 = new iTextSharp.awt.geom.Point(p2.X + lineSize, p2.Y + lineSize * 2); |
|
68 |
|
|
69 |
|
|
70 |
//iTextSharp.awt.geom.Point startPoint_p1 = new iTextSharp.awt.geom.Point(p1.X - lineSize, p1.Y - lineSize * 2); |
|
71 |
//iTextSharp.awt.geom.Point endPoint_p1 = new iTextSharp.awt.geom.Point(p1.X - lineSize, p1.Y + lineSize * 2); |
|
72 |
|
|
73 |
//iTextSharp.awt.geom.Point startPoint_p2 = new iTextSharp.awt.geom.Point(p2.X + lineSize, p2.Y - lineSize * 2); |
|
74 |
//iTextSharp.awt.geom.Point endPoint_p2 = new iTextSharp.awt.geom.Point(p2.X + lineSize, p2.Y + lineSize * 2); |
|
75 |
|
|
76 |
iTextSharp.awt.geom.Point startPoint_p1 = new iTextSharp.awt.geom.Point(p1.X - 1, p1.Y - lineSize * 2); |
|
77 |
iTextSharp.awt.geom.Point endPoint_p1 = new iTextSharp.awt.geom.Point(p1.X - 1, p1.Y + lineSize * 2); |
|
78 |
|
|
79 |
iTextSharp.awt.geom.Point startPoint_p2 = new iTextSharp.awt.geom.Point(p2.X + 1, p2.Y - lineSize * 2); |
|
80 |
iTextSharp.awt.geom.Point endPoint_p2 = new iTextSharp.awt.geom.Point(p2.X + 1, p2.Y + lineSize * 2); |
|
81 |
|
|
82 |
iTextSharp.awt.geom.Point rotateP1x = RotateAbout(new iTextSharp.awt.geom.Point(p1.X, p1.Y), startPoint_p1, theta); |
|
83 |
iTextSharp.awt.geom.Point rotateP1y = RotateAbout(new iTextSharp.awt.geom.Point(p1.X, p1.Y), endPoint_p1, theta); |
|
84 |
|
|
85 |
iTextSharp.awt.geom.Point rotateP2x = RotateAbout(new iTextSharp.awt.geom.Point(p2.X, p2.Y), startPoint_p2, theta); |
|
86 |
iTextSharp.awt.geom.Point rotateP2y = RotateAbout(new iTextSharp.awt.geom.Point(p2.X, p2.Y), endPoint_p2, theta); |
|
87 |
|
|
88 |
contentByte.NewPath(); |
|
89 |
contentByte.MoveTo((float)rotateP1x.x, (float)rotateP1x.y); |
|
90 |
contentByte.LineTo((float)rotateP1y.x, (float)rotateP1y.y); |
|
91 |
contentByte.MoveTo((float)rotateP2x.x, (float)rotateP2x.y); |
|
92 |
contentByte.LineTo((float)rotateP2y.x, (float)rotateP2y.y); |
|
93 |
contentByte.ClosePathStroke(); |
|
94 |
contentByte.RestoreState(); |
|
95 |
} |
|
96 |
} |
|
97 |
} |
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/DrawSet_Cloud.cs | ||
---|---|---|
56 | 56 |
uses.Y = lastPt.Y; |
57 | 57 |
} |
58 | 58 |
} |
59 |
|
|
60 | 59 |
} |
61 | 60 |
|
62 | 61 |
public static void DrawCloud(List<Point> points, double lineSize, double arcLength, PdfContentByte contentByte, System.Windows.Media.DoubleCollection DashSize, |
... | ... | |
88 | 87 |
GenerateLineWithCloud(points[i % count], points[(i + 1) % count], arcLength, contentByte); |
89 | 88 |
} |
90 | 89 |
contentByte.MoveTo(points[0].X, points[0].Y); /// move to start point |
91 |
HoneyPDFLib_DrawSet_Shape.PaintFill(contentByte, PaintSet.None, bs, opac);
|
|
90 |
DrawSet_Shape.PaintFill(contentByte, PaintSet.None, bs, opac); |
|
92 | 91 |
|
93 | 92 |
if (PaintStyle != PaintSet.None) |
94 | 93 |
{ |
... | ... | |
96 | 95 |
contentByte.MoveTo(points[0].X, points[0].Y); |
97 | 96 |
for (int i = 1; i <= points.Count; ++i) contentByte.LineTo(points[i%points.Count].X, points[i%points.Count].Y); |
98 | 97 |
bs = new BaseColor(fillColor.Color.R, fillColor.Color.G, fillColor.Color.B, fillColor.Color.A); |
99 |
HoneyPDFLib_DrawSet_Shape.PaintFill(contentByte, PaintStyle, bs, opac);
|
|
98 |
DrawSet_Shape.PaintFill(contentByte, PaintStyle, bs, opac); |
|
100 | 99 |
} |
101 | 100 |
} |
102 | 101 |
contentByte.RestoreState(); |
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/DrawSet_DrawString.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 partial class DrawSet_Text |
|
14 |
{ |
|
15 |
/// <summary> |
|
16 |
/// create a font with given parameters |
|
17 |
/// </summary> |
|
18 |
/// <param name="fontstyle"></param> |
|
19 |
/// <param name="fontweight"></param> |
|
20 |
/// <param name="isUnderline"></param> |
|
21 |
/// <param name="rect"></param> |
|
22 |
/// <param name="text"></param> |
|
23 |
/// <returns></returns> |
|
24 |
private static iTextSharp.text.Font CreateFont(FontFamily fontFamilly, FontStyle fontstyle, FontWeight fontweight, TextDecorationCollection isUnderline, Rectangle rect, string text) |
|
25 |
{ |
|
26 |
///int iFonts = FontFactory.RegisterDirectory(Environment.GetFolderPath(Environment.SpecialFolder.Fonts)); |
|
27 |
string sFontPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "Arial Unicode MS.TTF"); |
|
28 |
|
|
29 |
//bool bTextIsAscii = !text.Any(c => !Char.IsLetterOrDigit(c)); /// text가 ascii인지 확인 |
|
30 |
//if (bTextIsAscii) |
|
31 |
//{ |
|
32 |
// sFontPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "TIMES.TTF"); |
|
33 |
//} |
|
34 |
|
|
35 |
double dFontSize = double.MaxValue; |
|
36 |
BaseFont bf = BaseFont.CreateFont(sFontPath, BaseFont.IDENTITY_H, BaseFont.EMBEDDED); |
|
37 |
string[] tokens = text.Split(Environment.NewLine.ToArray(), StringSplitOptions.RemoveEmptyEntries); |
|
38 |
foreach (var token in tokens) |
|
39 |
{ |
|
40 |
float width = bf.GetWidthPoint(token, rect.Height); |
|
41 |
double ratio = rect.Width / width; |
|
42 |
double size = rect.Height * ratio; |
|
43 |
dFontSize = size < dFontSize ? size : dFontSize; |
|
44 |
} |
|
45 |
|
|
46 |
iTextSharp.text.Font itextFont = new iTextSharp.text.Font(bf, (float)(dFontSize)); |
|
47 |
|
|
48 |
itextFont.SetStyle(0); |
|
49 |
if (fontstyle == FontStyles.Italic) |
|
50 |
{ |
|
51 |
//기울임 |
|
52 |
itextFont.SetStyle(itextFont.Style | Font.ITALIC); |
|
53 |
} |
|
54 |
if (fontweight == FontWeights.Bold) |
|
55 |
{ |
|
56 |
//굵기 |
|
57 |
itextFont.SetStyle(itextFont.Style | Font.BOLD); |
|
58 |
} |
|
59 |
|
|
60 |
if (isUnderline == TextDecorations.Underline) |
|
61 |
{ |
|
62 |
//밑줄; |
|
63 |
itextFont.SetStyle(itextFont.Style | Font.UNDERLINE); |
|
64 |
} |
|
65 |
|
|
66 |
return itextFont; |
|
67 |
} |
|
68 |
|
|
69 |
/// <summary> |
|
70 |
/// draw string |
|
71 |
/// </summary> |
|
72 |
/// <param name="sp"></param> |
|
73 |
/// <param name="ep"></param> |
|
74 |
/// <param name="lineSize"></param> |
|
75 |
/// <param name="contentByte"></param> |
|
76 |
/// <param name="color"></param> |
|
77 |
/// <param name="PaintStyle"></param> |
|
78 |
/// <param name="FontSize"></param> |
|
79 |
/// <param name="fontFamilly"></param> |
|
80 |
/// <param name="fontstyle"></param> |
|
81 |
/// <param name="fontweight"></param> |
|
82 |
/// <param name="isUnderline"></param> |
|
83 |
/// <param name="text"></param> |
|
84 |
/// <param name="size"></param> |
|
85 |
/// <param name="opac"></param> |
|
86 |
/// <param name="Angle"></param> |
|
87 |
public static void DrawString(Point sp, Point ep, double lineSize, iTextSharp.text.pdf.PdfContentByte contentByte, SolidColorBrush color, PaintSet PaintStyle, double FontSize, |
|
88 |
FontFamily fontFamilly, FontStyle fontstyle, FontWeight fontweight, TextDecorationCollection isUnderline, |
|
89 |
string text, System.Drawing.SizeF size, double opac, double Angle) |
|
90 |
{ |
|
91 |
BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A); |
|
92 |
contentByte.SaveState(); |
|
93 |
|
|
94 |
Rect rect = new Rect(sp, ep); |
|
95 |
List<Point> points = new List<Point> |
|
96 |
{ |
|
97 |
rect.TopLeft, rect.BottomLeft, |
|
98 |
rect.BottomRight, rect.TopRight |
|
99 |
}; |
|
100 |
rect.Inflate(lineSize * 0.5, lineSize * 0.5); /// 점을 중심으로 라인 두께가 그려짐으로 사각형 안쪽으로 텍스트가 쓰여지게 사각형을 키움 |
|
101 |
|
|
102 |
var calRect = MathSet.GetPointsToRectX(points); |
|
103 |
if(lineSize*2 > calRect.Height) lineSize *= 0.3; /// 텍스트가 뒤집어 지는것 방지 |
|
104 |
if (calRect.Top > calRect.Bottom) |
|
105 |
{ |
|
106 |
calRect.Left += (float)(lineSize*0.5); |
|
107 |
calRect.Top -= (float)(lineSize*0.5); |
|
108 |
calRect.Right -= (float)(lineSize*0.5); |
|
109 |
calRect.Bottom += (float)(lineSize*0.5); |
|
110 |
} |
|
111 |
else ///Top이 작을 경우(예: 문서를 회전하여 Comment 작업한 경우) |
|
112 |
{ |
|
113 |
calRect.Left += (float)(lineSize*0.5); |
|
114 |
calRect.Top += (float)(lineSize*0.5); |
|
115 |
calRect.Right -= (float)(lineSize*0.5); |
|
116 |
calRect.Bottom -= (float)(lineSize*0.5); |
|
117 |
} |
|
118 |
|
|
119 |
contentByte.SetLineWidth((float)lineSize); |
|
120 |
|
|
121 |
System.Drawing.Drawing2D.Matrix mat = new System.Drawing.Drawing2D.Matrix(); |
|
122 |
mat.RotateAt((float)Angle * -1, new System.Drawing.PointF((float)sp.X, (float)sp.Y)); |
|
123 |
|
|
124 |
/// transform text border |
|
125 |
System.Drawing.PointF[] border = new System.Drawing.PointF[4] |
|
126 |
{ |
|
127 |
new System.Drawing.PointF((float)points[0].X, (float)points[0].Y), |
|
128 |
new System.Drawing.PointF((float)points[1].X, (float)points[1].Y), |
|
129 |
new System.Drawing.PointF((float)points[2].X, (float)points[2].Y), |
|
130 |
new System.Drawing.PointF((float)points[3].X, (float)points[3].Y) |
|
131 |
}; |
|
132 |
mat.TransformPoints(border); /// transform if given angle is not 0 |
|
133 |
var transformed = border.Select(param => new Point(param.X, param.Y)).ToList(); |
|
134 |
/// up to here |
|
135 |
|
|
136 |
if ((PaintStyle & PaintSet.Hatch) == PaintSet.Hatch) |
|
137 |
{ |
|
138 |
/// default arc length |
|
139 |
double ArcLength = 10/(MarkupToPDF.scaleWidth > MarkupToPDF.scaleHeight ? MarkupToPDF.scaleWidth : MarkupToPDF.scaleHeight); |
|
140 |
|
|
141 |
DrawSet_Cloud.DrawCloud(transformed, lineSize, ArcLength, contentByte, new DoubleCollection(99999), color, new SolidColorBrush(Color.FromRgb(255, 255, 255)), (PaintStyle & ~PaintSet.Hatch) | PaintSet.Fill, 0.7); |
|
142 |
|
|
143 |
contentByte.RestoreState(); |
|
144 |
contentByte.SaveState(); |
|
145 |
} |
|
146 |
else if (((PaintStyle & PaintSet.Highlight) == PaintSet.Highlight) || ((PaintStyle & PaintSet.Fill) == PaintSet.Fill)) |
|
147 |
{ |
|
148 |
contentByte.NewPath(); |
|
149 |
contentByte.MoveTo(transformed[0].X, transformed[0].Y); |
|
150 |
for (int i = 1; i <= transformed.Count; ++i) contentByte.LineTo(transformed[i%transformed.Count].X, transformed[i%transformed.Count].Y); |
|
151 |
DrawSet_Text.PaintFill(contentByte, PaintStyle, bs); |
|
152 |
} |
|
153 |
|
|
154 |
iTextSharp.text.Font itextFont = DrawSet_Text.CreateFont(fontFamilly, fontstyle, fontweight, isUnderline, calRect, text); |
|
155 |
|
|
156 |
contentByte.SetColorStroke(bs); |
|
157 |
contentByte.SetColorFill(bs); |
|
158 |
|
|
159 |
string[] tokens = text.Split(new[] { Environment.NewLine }, StringSplitOptions.None); |
|
160 |
/// single line text |
|
161 |
if (tokens.Length == 1) |
|
162 |
{ |
|
163 |
float height = itextFont.BaseFont.GetAscentPoint(text, itextFont.CalculatedSize) - itextFont.BaseFont.GetDescentPoint(text, itextFont.CalculatedSize); |
|
164 |
float spacing = (float)((calRect.Height - height) * 0.5); |
|
165 |
System.Drawing.PointF[] origin = new System.Drawing.PointF[1] |
|
166 |
{ |
|
167 |
new System.Drawing.PointF((float)((calRect.Left + calRect.Right) * 0.5), (float)((calRect.Top + calRect.Bottom - height) * 0.5)) |
|
168 |
}; |
|
169 |
mat.TransformPoints(origin); |
|
170 |
|
|
171 |
ColumnText.ShowTextAligned(contentByte, Element.ALIGN_CENTER, new Phrase(new Chunk(text, itextFont)), origin[0].X, origin[0].Y, (float)-Angle); |
|
172 |
} |
|
173 |
/// multi line text |
|
174 |
else |
|
175 |
{ |
|
176 |
ColumnText ct = new ColumnText(contentByte); |
|
177 |
PdfGState gs3 = new PdfGState(); |
|
178 |
gs3.StrokeOpacity = (float)opac; |
|
179 |
gs3.FillOpacity = (float)opac; |
|
180 |
|
|
181 |
ct.Canvas.Transform(mat); |
|
182 |
ct.Canvas.SetGState(gs3); |
|
183 |
float fLeadingSize = (calRect.Height / (float)tokens.Length); |
|
184 |
float spacing = ((float)calRect.Height - tokens.Length * itextFont.CalculatedSize) / (tokens.Length + 2); |
|
185 |
/// add paddings |
|
186 |
calRect.Right += (float)(lineSize * 0.5); |
|
187 |
if (calRect.Top > calRect.Bottom) |
|
188 |
calRect.Bottom -= (float)(lineSize * 0.5); |
|
189 |
else |
|
190 |
calRect.Top -= (float)(lineSize * 0.5); |
|
191 |
/// up to here |
|
192 |
ct.SetLeading(itextFont.CalculatedSize + (float)((tokens.Length > 1) ? spacing : 0), ct.MultipliedLeading); |
|
193 |
ct.SetSimpleColumn(calRect); |
|
194 |
ct.Alignment = Element.ALIGN_MIDDLE | Element.ALIGN_CENTER; |
|
195 |
ct.SetText(new Phrase(new Chunk(text, itextFont))); |
|
196 |
ct.Go(); |
|
197 |
} |
|
198 |
|
|
199 |
contentByte.RestoreState(); |
|
200 |
} |
|
201 |
|
|
202 |
/// <summary> |
|
203 |
/// draw arrow string |
|
204 |
/// </summary> |
|
205 |
/// <param name="sp"></param> |
|
206 |
/// <param name="ep"></param> |
|
207 |
/// <param name="ptHead"></param> |
|
208 |
/// <param name="ptMid"></param> |
|
209 |
/// <param name="lineSize"></param> |
|
210 |
/// <param name="contentByte"></param> |
|
211 |
/// <param name="color"></param> |
|
212 |
/// <param name="PaintStyle"></param> |
|
213 |
/// <param name="FontSize"></param> |
|
214 |
/// <param name="isHighlight"></param> |
|
215 |
/// <param name="fontFamilly"></param> |
|
216 |
/// <param name="fontstyle"></param> |
|
217 |
/// <param name="fontweight"></param> |
|
218 |
/// <param name="isUnderline"></param> |
|
219 |
/// <param name="text"></param> |
|
220 |
/// <param name="size"></param> |
|
221 |
/// <param name="opac"></param> |
|
222 |
/// <param name="Angle"></param> |
|
223 |
public static void DrawString_ArrowText(Point sp, Point ep, Point ptHead, Point ptMid, bool bIsFixed, |
|
224 |
double lineSize, iTextSharp.text.pdf.PdfContentByte contentByte, SolidColorBrush color, PaintSet PaintStyle, double FontSize, |
|
225 |
bool isHighlight, FontFamily fontFamilly, FontStyle fontstyle, FontWeight fontweight, TextDecorationCollection isUnderline, |
|
226 |
string text, System.Drawing.SizeF size, double opac, double Angle) |
|
227 |
{ |
|
228 |
Rect rect = new Rect(sp, ep); |
|
229 |
List<Point> points = new List<Point> |
|
230 |
{ |
|
231 |
rect.TopLeft, rect.BottomLeft, |
|
232 |
rect.BottomRight, rect.TopRight |
|
233 |
}; |
|
234 |
|
|
235 |
System.Drawing.Drawing2D.Matrix mat = new System.Drawing.Drawing2D.Matrix(); |
|
236 |
mat.RotateAt((float)Angle * -1, new System.Drawing.PointF((float)sp.X, (float)sp.Y)); |
|
237 |
|
|
238 |
/// transform text border |
|
239 |
System.Drawing.PointF[] border = new System.Drawing.PointF[4] |
|
240 |
{ |
|
241 |
new System.Drawing.PointF((float)points[0].X, (float)points[0].Y), |
|
242 |
new System.Drawing.PointF((float)points[1].X, (float)points[1].Y), |
|
243 |
new System.Drawing.PointF((float)points[2].X, (float)points[2].Y), |
|
244 |
new System.Drawing.PointF((float)points[3].X, (float)points[3].Y) |
|
245 |
}; |
|
246 |
mat.TransformPoints(border); /// transform if given angle is not 0 |
|
247 |
var transformed = border.Select(param => new Point(param.X, param.Y)).ToList(); |
|
248 |
/// up to here |
|
249 |
|
|
250 |
DrawSet_Text.DrawString(sp, ep, lineSize, contentByte, color, PaintStyle, FontSize, fontFamilly, fontstyle, fontweight, isUnderline, text, size, opac, Angle); |
|
251 |
DrawLeaderLine(ptHead, ptMid, bIsFixed, transformed, lineSize, contentByte, color, opac); |
|
252 |
} |
|
253 |
|
|
254 |
/// <summary> |
|
255 |
/// draw leader line for arrow_text |
|
256 |
/// </summary> |
|
257 |
/// <author>humkyung</author> |
|
258 |
/// <date>2019.06.12</date> |
|
259 |
/// <param name="start"></param> |
|
260 |
/// <param name="mid"></param> |
|
261 |
/// <param name="border"></param> |
|
262 |
/// <param name="LineSize"></param> |
|
263 |
/// <param name="contentByte"></param> |
|
264 |
/// <param name="color"></param> |
|
265 |
/// <param name="opac"></param> |
|
266 |
private static void DrawLeaderLine(Point start, Point mid, bool bIsFixed, List<Point> border, double LineSize, iTextSharp.text.pdf.PdfContentByte contentByte, SolidColorBrush color, double opac) |
|
267 |
{ |
|
268 |
/// prepare connection points |
|
269 |
List<Point> ptConns = new List<Point>(); |
|
270 |
for (int i = 0; i < border.Count; ++i) |
|
271 |
{ |
|
272 |
ptConns.Add(new Point((border[i].X + border[(i + 1) % border.Count].X) * 0.5, (border[i].Y + border[(i + 1) % border.Count].Y) * 0.5)); |
|
273 |
} |
|
274 |
/// up to here |
|
275 |
|
|
276 |
Point? anchor = null; |
|
277 |
double dMinDist = Double.MaxValue; |
|
278 |
foreach (var point in ptConns) |
|
279 |
{ |
|
280 |
double dx = point.X - mid.X; |
|
281 |
double dy = point.Y - mid.Y; |
|
282 |
double dist = dx * dx + dy * dy; |
|
283 |
if (dist < dMinDist) |
|
284 |
{ |
|
285 |
dMinDist = dist; |
|
286 |
anchor = point; |
|
287 |
} |
|
288 |
} |
|
289 |
|
|
290 |
Controls_PDF.DrawSet_Arrow.SingleAllow(start, bIsFixed ? mid : anchor.Value, LineSize, contentByte, color, opac); |
|
291 |
Controls_PDF.DrawSet_Line.DrawLine(start, bIsFixed ? mid : anchor.Value, LineSize, contentByte, new DoubleCollection(9999), color, opac); |
|
292 |
if (bIsFixed) |
|
293 |
{ |
|
294 |
Controls_PDF.DrawSet_Line.DrawLine(mid, anchor.Value, LineSize, contentByte, new DoubleCollection(9999), color, opac); |
|
295 |
} |
|
296 |
} |
|
297 |
|
|
298 |
private static void PaintFill(PdfContentByte contentByte, PaintSet PaintStyle, BaseColor bs) |
|
299 |
{ |
|
300 |
if ((PaintStyle & PaintSet.Highlight) == PaintSet.Highlight) |
|
301 |
{ |
|
302 |
PdfGState gs = new PdfGState(); |
|
303 |
gs.FillOpacity = (float)0.7; |
|
304 |
contentByte.SetGState(gs); |
|
305 |
contentByte.SetColorFill(BaseColor.YELLOW); |
|
306 |
if ((PaintStyle & PaintSet.Fill) == PaintSet.Fill) |
|
307 |
{ |
|
308 |
contentByte.SetColorStroke(bs); |
|
309 |
contentByte.ClosePathFillStroke(); |
|
310 |
} |
|
311 |
else |
|
312 |
contentByte.Fill(); |
|
313 |
|
|
314 |
return; |
|
315 |
} |
|
316 |
|
|
317 |
if ((PaintStyle & PaintSet.Fill) == PaintSet.Fill) |
|
318 |
{ |
|
319 |
PdfGState gs = new PdfGState(); |
|
320 |
gs.FillOpacity = (float)0.7; |
|
321 |
contentByte.SetGState(gs); |
|
322 |
contentByte.SetColorStroke(bs); |
|
323 |
contentByte.SetColorFill(BaseColor.WHITE); |
|
324 |
contentByte.ClosePathFillStroke(); |
|
325 |
} |
|
326 |
|
|
327 |
if ((PaintStyle & PaintSet.Hatch) == PaintSet.Hatch) |
|
328 |
{ |
|
329 |
PdfPatternPainter line = contentByte.CreatePattern(8, 8, 6, 6, bs); |
|
330 |
line.SetLineWidth(1); |
|
331 |
line.MoveTo(0, 0); |
|
332 |
line.LineTo(100, 100); |
|
333 |
line.Stroke(); |
|
334 |
contentByte.SetPatternFill(line); |
|
335 |
|
|
336 |
PatternColor colors = new PatternColor(line); |
|
337 |
contentByte.SetPatternFill(line); |
|
338 |
contentByte.SetColorFill(colors); |
|
339 |
contentByte.Fill(); |
|
340 |
} |
|
341 |
|
|
342 |
if (PaintStyle == PaintSet.Outline) |
|
343 |
{ |
|
344 |
contentByte.SetColorStroke(bs); |
|
345 |
contentByte.ClosePathStroke(); |
|
346 |
} |
|
347 |
} |
|
348 |
} |
|
349 |
} |
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/DrawSet_Image.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.IO; |
|
4 |
using System.Linq; |
|
5 |
using System.Net; |
|
6 |
using System.Text; |
|
7 |
using System.Xml; |
|
8 |
using iTextSharp.text; |
|
9 |
using iTextSharp.text.pdf; |
|
10 |
using KCOMDataModel.DataModel; |
|
11 |
using MarkupToPDF.Common; |
|
12 |
using MarkupToPDF.Controls.Common; |
|
13 |
|
|
14 |
|
|
15 |
namespace MarkupToPDF.Controls_PDF |
|
16 |
{ |
|
17 |
public class DrawSet_Image : BaseMethod |
|
18 |
{ |
|
19 |
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) |
|
20 |
{ |
|
21 |
contentByte.SaveState(); |
|
22 |
byte[] imageBytes = null; |
|
23 |
using (DataController dataController = new DataController()) |
|
24 |
{ |
|
25 |
imageBytes = dataController.GetUserSignData(projectNo, UserID); |
|
26 |
} |
|
27 |
|
|
28 |
using (System.IO.MemoryStream ms = new System.IO.MemoryStream(imageBytes)) |
|
29 |
{ |
|
30 |
var midP = MathSet.getMiddlePoint(startPoint, endPoint); |
|
31 |
List<System.Windows.Point> tempPoint = new List<System.Windows.Point>(); |
|
32 |
foreach (var item in pointSet) |
|
33 |
{ |
|
34 |
tempPoint.Add(MathSet.RotateAbout(midP, item, Angle)); |
|
35 |
} |
|
36 |
|
|
37 |
var Rect = GetPointsToRectX(tempPoint); |
|
38 |
|
|
39 |
Image img = Image.GetInstance(ms); |
|
40 |
img.ScaleAbsolute(Rect.Width, Rect.Height); |
|
41 |
|
|
42 |
img.SetAbsolutePosition(Rect.Left + ((Rect.Width - img.ScaledWidth) / 2), Rect.Bottom + ((Rect.Height - img.ScaledHeight) / 2)); |
|
43 |
var x = Rect.Left + ((Rect.Width - img.ScaledWidth) / 2); |
|
44 |
var y = Rect.Bottom + ((Rect.Height - img.ScaledHeight) / 2); |
|
45 |
midP = MathSet.getMiddlePoint(new System.Windows.Point(x, y), new System.Windows.Point(x + img.ScaledWidth, y + img.ScaledHeight)); |
|
46 |
System.Drawing.Drawing2D.Matrix mat2 = new System.Drawing.Drawing2D.Matrix(); |
|
47 |
mat2.RotateAt((float)Angle * -1, new System.Drawing.PointF((float)midP.X, (float)midP.Y)); |
|
48 |
contentByte.Transform(mat2); |
|
49 |
PdfGState gs1 = new PdfGState(); |
|
50 |
gs1.FillOpacity = (float)opac; |
|
51 |
contentByte.SetGState(gs1); |
|
52 |
contentByte.AddImage(img); |
|
53 |
} |
|
54 |
|
|
55 |
contentByte.RestoreState(); |
|
56 |
} |
|
57 |
|
|
58 |
public static void DrawImage(System.Windows.Point startPoint, System.Windows.Point endPoint, List<System.Windows.Point> pointSet, PdfContentByte contentByte, string filePath, double Angle, double opac) |
|
59 |
{ |
|
60 |
contentByte.SaveState(); |
|
61 |
Image image = FromURI(filePath); |
|
62 |
var midP = MathSet.getMiddlePoint(startPoint, endPoint); |
|
63 |
List<System.Windows.Point> tempPoint = new List<System.Windows.Point>(); |
|
64 |
foreach (var item in pointSet) |
|
65 |
{ |
|
66 |
tempPoint.Add(MathSet.RotateAbout(midP, item, Angle)); |
|
67 |
} |
|
68 |
var Rect3 = GetPointsToRectX(tempPoint); |
|
69 |
|
|
70 |
//image.ScaleAbsolute(Rect2.Width, Rect2.Height); |
|
71 |
image.ScaleAbsolute(Rect3.Width, Rect3.Height); |
|
72 |
image.SetAbsolutePosition((float)startPoint.X, (float)startPoint.Y - Rect3.Height); |
|
73 |
|
|
74 |
System.Drawing.Drawing2D.Matrix mat2 = new System.Drawing.Drawing2D.Matrix(); |
|
75 |
mat2.RotateAt((float)Angle * -1, new System.Drawing.PointF((float)startPoint.X, (float)startPoint.Y)); |
|
76 |
contentByte.Transform(mat2); |
|
77 |
PdfGState gs1 = new PdfGState(); |
|
78 |
gs1.FillOpacity = (float)opac; |
|
79 |
contentByte.SetGState(gs1); |
|
80 |
contentByte.AddImage(image); |
|
81 |
contentByte.RestoreState(); |
|
82 |
} |
|
83 |
|
|
84 |
public static Image FromURI(string uri) |
|
85 |
{ |
|
86 |
HttpWebRequest webRequest = (HttpWebRequest)HttpWebRequest.Create(uri); |
|
87 |
webRequest.AllowWriteStreamBuffering = true; |
|
88 |
WebResponse webResponse = webRequest.GetResponse(); |
|
89 |
//System.Drawing.Image image = System.Drawing.Image.FromStream(webResponse.GetResponseStream()); |
|
90 |
Image image = Image.GetInstance(webResponse.GetResponseStream()); |
|
91 |
webResponse.Close(); |
|
92 |
|
|
93 |
return image; |
|
94 |
} |
|
95 |
} |
|
96 |
} |
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/DrawSet_Line.cs | ||
---|---|---|
1 |
using iTextSharp.text.pdf; |
|
2 |
using System; |
|
3 |
using System.Collections.Generic; |
|
4 |
using System.Linq; |
|
5 |
using System.Text; |
|
6 |
using System.Windows; |
|
7 |
using iTextSharp.text.pdf; |
|
8 |
using System.Windows.Media; |
|
9 |
using iTextSharp.text; |
|
10 |
|
|
11 |
namespace MarkupToPDF.Controls_PDF |
|
12 |
{ |
|
13 |
public partial class DrawSet_Line |
|
14 |
{ |
|
15 |
public static void DrawLine(Point startP, Point endP, double lineSize, PdfContentByte contentByte, System.Windows.Media.DoubleCollection DashSize, System.Windows.Media.SolidColorBrush color, double opacity) |
|
16 |
{ |
|
17 |
#region Line 파트 |
|
18 |
BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A); |
|
19 |
contentByte.SaveState(); |
|
20 |
PdfGState gs1 = new PdfGState(); |
|
21 |
gs1.StrokeOpacity = (float)opacity; |
|
22 |
contentByte.SetGState(gs1); |
|
23 |
var rect = contentByte.PdfDocument.PageSize; |
|
24 |
contentByte.SetColorStroke(bs); |
|
25 |
if (DashSize.Count >1) |
|
26 |
{ |
|
27 |
List<float> DashSet = new List<float>(); |
|
28 |
DashSize.ToList().ForEach(data => DashSet.Add((float)data * 1)); |
|
29 |
contentByte.SetLineDash(DashSet.ToArray(), DashSet.Count - 2); |
|
30 |
} |
|
31 |
|
|
32 |
contentByte.SetLineWidth((float)lineSize); |
|
33 |
contentByte.MoveTo((float)startP.X, (float)startP.Y); |
|
34 |
contentByte.LineTo((float)endP.X, (float)endP.Y); |
|
35 |
contentByte.Stroke(); |
|
36 |
contentByte.RestoreState(); |
|
37 |
#endregion |
|
38 |
|
|
39 |
#region 큰 선(여러개 쪼개기 전) |
|
40 |
//BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A); |
|
41 |
//contentByte.SaveState(); |
|
42 |
//var rect = contentByte.PdfDocument.PageSize; |
|
43 |
//contentByte.SetColorStroke(bs); |
|
44 |
//contentByte.SetLineWidth((float)lineSize - 3); |
|
45 |
//contentByte.Stroke(); |
|
46 |
|
|
47 |
//contentByte.SetColorStroke(BaseColor.BLUE); |
|
48 |
//contentByte.NewPath(); |
|
49 |
|
|
50 |
//contentByte.MoveTo((float)p1.X, (float)p1.Y); |
|
51 |
//contentByte.LineTo((float)p2.X, (float)p2.Y); |
|
52 |
|
|
53 |
////List<Point> pointSet = new List<Point>(); |
|
54 |
////pointSet.Add(p1); |
|
55 |
////pointSet.Add(p2); |
|
56 |
|
|
57 |
////double area = MarkupEditToolKit.Common.MathSet.AreaOf(pointSet); |
|
58 |
////bool reverse = (area < 0); |
|
59 |
|
|
60 |
//var midP = MarkupEditToolKit.Common.MathSet.getMiddlePoint(p1, p2); |
|
61 |
|
|
62 |
////double dx = p2.X - p1.X; |
|
63 |
////double dy = p2.Y - p1.Y; |
|
64 |
//double l = MarkupEditToolKit.Common.MathSet.DistanceTo(p1, p2); /// distance between p1 and p2 |
|
65 |
|
|
66 |
|
|
67 |
//contentByte.MoveTo((float)p1.X, (float)p1.Y);/// |
|
68 |
//contentByte.LineTo((float)p1.X, (float)(p1.Y + l)); |
|
69 |
//contentByte.LineTo((float)(p1.X + l), (float)(p1.Y + l)); |
|
70 |
//contentByte.LineTo((float)(p2.X), (float)(p2.Y)); |
|
71 |
//contentByte.Stroke(); |
|
72 |
//contentByte.SetColorStroke(bs); |
|
73 |
|
|
74 |
//contentByte.MoveTo((float)p1.X, (float)p1.Y);/// |
|
75 |
//var endP = MarkupEditToolKit.Common.MathSet.RotateAbout(midP, new Point(midP.X + l, midP.Y), 90); |
|
76 |
//contentByte.CurveTo((float)p1.X, (float)p1.Y, (float)endP.X, (float)endP.Y, (float)p2.X, (float)p2.Y); |
|
77 |
|
|
78 |
|
|
79 |
//var arcLength = 30.0 / 3.0; //arcLength 파라미터 default 30.0 |
|
80 |
//double count = l / arcLength; //얼추맞네! 'ㅡ' |
|
81 |
|
|
82 |
//contentByte.Stroke(); |
|
83 |
//contentByte.ClosePath(); |
|
84 |
|
|
85 |
|
|
86 |
//contentByte.RestoreState(); |
|
87 |
#endregion |
|
88 |
|
|
89 |
#region 두 라인에 대한 완성형 |
|
90 |
|
|
91 |
//BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A); |
|
92 |
//contentByte.SaveState(); |
|
93 |
//var rect = contentByte.PdfDocument.PageSize; |
|
94 |
//contentByte.SetColorStroke(bs); |
|
95 |
//contentByte.SetLineWidth((float)lineSize - 3); |
|
96 |
//contentByte.Stroke(); |
|
97 |
|
|
98 |
//contentByte.SetColorStroke(BaseColor.BLUE); |
|
99 |
//contentByte.NewPath(); |
|
100 |
////var arcLength = 30.0 / 3.0; //arcLength 파라미터 default 30.0 |
|
101 |
//var arcLength = 30.0 / 3.0; //arcLength 파라미터 default 30.0 |
|
102 |
|
|
103 |
//double l = MarkupEditToolKit.Common.MathSet.DistanceTo(p1, p2); /// distance between p1 and p2 |
|
104 |
//double dx = p2.X - p1.X; |
|
105 |
//double dy = p1.Y - p2.Y; |
|
106 |
//dx /= l; |
|
107 |
//dy /= l; |
|
108 |
//double count = l / arcLength; //얼추맞네! 'ㅡ' |
|
109 |
|
|
110 |
//Point lastPt = new Point(p1.X, p1.Y); |
|
111 |
//Double j = 1; |
|
112 |
//Point uses = new Point(0, 0); |
|
113 |
//uses = lastPt; |
|
114 |
//contentByte.MoveTo((float)lastPt.X, (float)lastPt.Y); |
|
115 |
|
|
116 |
|
|
117 |
//for (j = 1; j < (count - 1); j++) |
|
118 |
//{ |
|
119 |
// var moveUsesX = j * dx * arcLength + lastPt.X; |
|
120 |
// var moveUsesY = lastPt.Y - (j * dy * arcLength); |
|
121 |
|
|
122 |
// Console.WriteLine(j + "번째 X : " + moveUsesX.ToString()); |
|
123 |
// Console.WriteLine(j + "번째 Y : " + moveUsesY.ToString()); |
|
124 |
|
|
125 |
// l = MarkupEditToolKit.Common.MathSet.DistanceTo(uses, new Point(moveUsesX, moveUsesY)); /// distance between p1 and p2 |
|
126 |
// /// |
|
127 |
// var midP = MarkupEditToolKit.Common.MathSet.getMiddlePoint(uses, new Point(moveUsesX, moveUsesY)); |
|
128 |
// var endP = MarkupEditToolKit.Common.MathSet.RotateAbout(midP, new Point(midP.X + l, midP.Y), 90); |
|
129 |
// contentByte.CurveTo((float)uses.X, (float)uses.Y, (float)endP.X, (float)endP.Y, (float)moveUsesX, (float)moveUsesY); |
|
130 |
|
|
131 |
|
|
132 |
// uses = new Point(moveUsesX, moveUsesY); |
|
133 |
|
|
134 |
// Console.WriteLine(j + "번째 uses X : " + uses.X.ToString()); |
|
135 |
// Console.WriteLine(j + "번째 uses Y : " + uses.Y.ToString()); |
|
136 |
|
|
137 |
// Console.WriteLine(); |
|
138 |
// Console.WriteLine(); |
|
139 |
//} |
|
140 |
//contentByte.Stroke(); |
|
141 |
//contentByte.ClosePathStroke(); |
|
142 |
//contentByte.RestoreState(); |
|
143 |
#endregion |
|
144 |
} |
|
145 |
|
|
146 |
public static void DrawLine(List<Point> list, double lineSize, PdfContentByte contentByte, System.Windows.Media.DoubleCollection DashSize, |
|
147 |
SolidColorBrush color, double opac) |
|
148 |
{ |
|
149 |
//lineSize += 0.5; |
|
150 |
BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A); |
|
151 |
contentByte.SaveState(); |
|
152 |
PdfGState gs1 = new PdfGState(); |
|
153 |
gs1.StrokeOpacity = (float)opac; |
|
154 |
contentByte.SetGState(gs1); |
|
155 |
var rect = contentByte.PdfDocument.PageSize; |
|
156 |
contentByte.SetColorStroke(bs); |
|
157 |
|
|
158 |
if (DashSize.Count > 1) |
|
159 |
{ |
|
160 |
List<float> DashSet = new List<float>(); |
|
161 |
DashSize.ToList().ForEach(data => DashSet.Add((float)data * 1)); |
|
162 |
contentByte.SetLineDash(DashSet.ToArray(), DashSet.Count - 2); |
|
163 |
} |
|
164 |
|
|
165 |
/// WPF defines a device-independent pixel as 1 / 96 per inch |
|
166 |
/// iTextSharp : "the default for the size of the unit in default user space (1/72 inch) |
|
167 |
contentByte.SetLineWidth((float)lineSize); |
|
168 |
for (int i = 0; i < list.Count; i++) |
|
169 |
{ |
|
170 |
if (i==0) |
|
171 |
{ |
|
172 |
contentByte.MoveTo((float)list[i].X, (float)list[i].Y); |
|
173 |
} |
|
174 |
else |
|
175 |
{ |
|
176 |
contentByte.LineTo((float)list[i].X, (float)list[i].Y); |
|
177 |
} |
|
178 |
} |
|
179 |
|
|
180 |
//foreach (var item in list) |
|
181 |
//{ |
|
182 |
// if (item == list.First()) |
|
183 |
// { |
|
184 |
// contentByte.MoveTo((float)item.X, (float)item.Y); |
|
185 |
// } |
|
186 |
// else |
|
187 |
// { |
|
188 |
// contentByte.LineTo((float)item.X, (float)item.Y); |
|
189 |
// } |
|
190 |
//} |
|
191 |
|
|
192 |
contentByte.Stroke(); |
|
193 |
contentByte.RestoreState(); |
|
194 |
} |
|
195 |
} |
|
196 |
} |
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/DrawSet_Shape.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Windows; |
|
6 |
using iTextSharp.text.pdf; |
|
7 |
using System.Windows.Media; |
|
8 |
using iTextSharp.text; |
|
9 |
using MarkupToPDF.Controls.Common; |
|
10 |
|
|
11 |
namespace MarkupToPDF.Controls_PDF |
|
12 |
{ |
|
13 |
public partial class DrawSet_Shape : BaseMethod |
|
14 |
{ |
|
15 |
//Rect , Triangle , PolygonType , to anything |
|
16 |
public static void DrawRectangle(List<Point> points, double lineSize, PdfContentByte contentByte, System.Windows.Media.DoubleCollection DashSize, |
|
17 |
SolidColorBrush color, PaintSet PaintStyle, double opac) |
|
18 |
{ |
|
19 |
BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A); |
|
20 |
contentByte.SaveState(); |
|
21 |
PdfGState gs1 = new PdfGState(); |
|
22 |
gs1.FillOpacity = (float)opac; |
|
23 |
gs1.StrokeOpacity = (float)opac; |
|
24 |
contentByte.SetGState(gs1); |
|
25 |
var rect = contentByte.PdfDocument.PageSize; |
|
26 |
contentByte.SetColorStroke(bs); |
|
27 |
if (DashSize.Count > 1) |
|
28 |
{ |
|
29 |
List<float> DashSet = new List<float>(); |
|
30 |
DashSize.ToList().ForEach(data => DashSet.Add((float)data * 1)); |
|
31 |
contentByte.SetLineDash(DashSet.ToArray(), DashSet.Count - 2); |
|
32 |
} |
|
33 |
|
|
34 |
contentByte.SetLineWidth((float)lineSize); |
|
35 |
contentByte.NewPath(); |
|
36 |
contentByte.MoveTo((float)points.First().X, (float)points.First().Y); |
|
37 |
|
|
38 |
foreach (var item in points) |
|
39 |
{ |
|
40 |
if (item == points.First()) |
|
41 |
{ |
|
42 |
contentByte.LineTo((float)item.X, (float)item.Y + ((float)lineSize - 2) / 2); |
|
43 |
|
|
44 |
} |
|
45 |
else |
|
46 |
{ |
|
47 |
contentByte.LineTo((float)item.X, (float)item.Y); |
|
48 |
} |
|
49 |
} |
|
50 |
contentByte.LineTo((float)points.First().X - ((float)lineSize - 2) / 2, (float)points.First().Y); |
|
51 |
|
|
52 |
DrawSet_Shape.PaintFill(contentByte, PaintStyle, bs, opac); |
|
53 |
|
|
54 |
contentByte.RestoreState(); |
|
55 |
contentByte.ClosePath(); |
|
56 |
} |
|
57 |
|
|
58 |
public static void DrawPolygon(List<Point> points, double lineSize, PdfContentByte contentByte, System.Windows.Media.DoubleCollection DashSize, |
|
59 |
SolidColorBrush color, PaintSet PaintStyle, double opac) |
|
60 |
{ |
|
61 |
BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A); |
|
62 |
contentByte.SaveState(); |
|
63 |
PdfGState gs1 = new PdfGState(); |
|
64 |
gs1.StrokeOpacity = (float)opac; |
|
65 |
gs1.FillOpacity = (float)opac; |
|
66 |
contentByte.SetGState(gs1); |
|
67 |
var rect = contentByte.PdfDocument.PageSize; |
|
68 |
contentByte.SetColorStroke(bs); |
|
69 |
if (DashSize.Count > 1) |
|
70 |
{ |
|
71 |
List<float> DashSet = new List<float>(); |
|
72 |
DashSize.ToList().ForEach(data => DashSet.Add((float)data * 1)); |
|
73 |
contentByte.SetLineDash(DashSet.ToArray(), DashSet.Count - 2); |
|
74 |
} |
|
75 |
|
|
76 |
contentByte.SetLineWidth((float)lineSize); |
|
77 |
|
|
78 |
contentByte.NewPath(); |
|
79 |
|
|
80 |
foreach (var item in points) //사용은 가능하지만 연결성이 떨어짐 |
|
81 |
{ |
|
82 |
if (item == points.First()) |
|
83 |
{ |
|
84 |
contentByte.MoveTo((float)item.X, (float)item.Y); |
|
85 |
} |
|
86 |
else |
|
87 |
{ |
|
88 |
contentByte.LineTo((float)item.X, (float)item.Y); |
|
89 |
} |
|
90 |
|
|
91 |
if (item == points.Last()) |
|
92 |
{ |
|
93 |
contentByte.LineTo((float)points.First().X, (float)points.First().Y); |
|
94 |
} |
|
95 |
} |
|
96 |
|
|
97 |
DrawSet_Shape.PaintFill(contentByte, PaintStyle, bs, opac); |
|
98 |
contentByte.RestoreState(); |
|
99 |
} |
|
100 |
|
|
101 |
/// <summary> |
|
102 |
/// draw circle |
|
103 |
/// </summary> |
|
104 |
/// <param name="sp"></param> |
|
105 |
/// <param name="ep"></param> |
|
106 |
/// <param name="lineSize"></param> |
|
107 |
/// <param name="contentByte"></param> |
|
108 |
/// <param name="DashSize"></param> |
|
109 |
/// <param name="color"></param> |
|
110 |
/// <param name="PaintStyle"></param> |
|
111 |
/// <param name="opac"></param> |
|
112 |
/// <param name="Angle"></param> |
|
113 |
/// <param name="pointSet"></param> |
|
114 |
public static void DrawCircle(Point sp, Point ep, double lineSize, PdfContentByte contentByte, System.Windows.Media.DoubleCollection DashSize, |
|
115 |
SolidColorBrush color, PaintSet PaintStyle, double opac, double Angle, List<Point> pointSet) |
|
116 |
{ |
|
117 |
BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A); |
|
118 |
contentByte.SaveState(); |
|
119 |
PdfGState gs1 = new PdfGState(); |
|
120 |
gs1.StrokeOpacity = (float)opac; |
|
121 |
gs1.FillOpacity = (float)opac; |
|
122 |
contentByte.SetGState(gs1); |
|
123 |
var rect = contentByte.PdfDocument.PageSize; |
|
124 |
contentByte.SetColorStroke(bs); |
|
125 |
if (DashSize.Count > 1) |
|
126 |
{ |
|
127 |
List<float> DashSet = new List<float>(); |
|
128 |
DashSize.ToList().ForEach(data => DashSet.Add((float)data * 1)); |
|
129 |
contentByte.SetLineDash(DashSet.ToArray(), DashSet.Count - 2); |
|
130 |
} |
|
131 |
|
|
132 |
contentByte.SetLineWidth((float)lineSize); |
|
133 |
|
|
134 |
contentByte.NewPath(); |
|
135 |
var midPoint = MathSet.getMiddlePoint(sp, ep); |
|
136 |
var angle = MathSet.AngleMethod(pointSet[0], pointSet[1]); |
|
137 |
|
|
138 |
var sp1 = MathSet.RotateAbout(midPoint, sp, angle * 1); |
|
139 |
var ep1 = MathSet.RotateAbout(midPoint, ep, angle * 1); |
|
140 |
|
|
141 |
|
|
142 |
System.Drawing.Drawing2D.Matrix mat2 = new System.Drawing.Drawing2D.Matrix(); |
|
143 |
mat2.RotateAt((float)Angle * -1, new System.Drawing.PointF((float)midPoint.X, (float)midPoint.Y)); |
|
144 |
contentByte.Transform(mat2); |
|
145 |
contentByte.Ellipse((float)sp1.X, (float)sp1.Y, (float)ep1.X, (float)ep1.Y); |
|
146 |
|
|
147 |
DrawSet_Shape.PaintFill(contentByte, PaintStyle | PaintSet.Outline, bs, opac); |
|
148 |
contentByte.RestoreState(); |
|
149 |
} |
|
150 |
|
|
151 |
public static void PaintFill(PdfContentByte contentByte, PaintSet PaintStyle, BaseColor bs, double opacity) |
|
152 |
{ |
|
153 |
if ((PaintStyle & PaintSet.Highlight) == PaintSet.Highlight) |
|
154 |
{ |
|
155 |
PdfGState gs = new PdfGState(); |
|
156 |
gs.FillOpacity = (float)0.7; |
|
157 |
contentByte.SetGState(gs); |
|
158 |
contentByte.SetColorFill(BaseColor.YELLOW); |
|
159 |
if ((PaintStyle & PaintSet.Fill) == PaintSet.Fill) |
|
160 |
{ |
|
161 |
contentByte.SetColorStroke(bs); |
|
162 |
contentByte.ClosePathFillStroke(); |
|
163 |
} |
|
164 |
else |
|
165 |
contentByte.Fill(); |
|
166 |
|
|
167 |
return; |
|
168 |
} |
|
169 |
|
|
170 |
if ((PaintStyle & PaintSet.Fill) == PaintSet.Fill) |
|
171 |
{ |
|
172 |
PdfGState gs = new PdfGState(); |
|
173 |
gs.FillOpacity = (float)opacity; |
|
174 |
contentByte.SetGState(gs); |
|
175 |
contentByte.SetColorFill(bs); |
|
176 |
contentByte.Fill(); |
|
177 |
} |
|
178 |
|
|
179 |
if ((PaintStyle & PaintSet.Hatch) == PaintSet.Hatch) |
|
180 |
{ |
|
181 |
PdfPatternPainter line = contentByte.CreatePattern(8, 8, 6, 6, bs); |
|
182 |
line.SetLineWidth(1); |
|
183 |
line.MoveTo(0, 0); |
|
184 |
line.LineTo(100, 100); |
|
185 |
line.Stroke(); |
|
186 |
contentByte.SetPatternFill(line); |
|
187 |
|
|
188 |
PatternColor colors = new PatternColor(line); |
|
189 |
contentByte.SetPatternFill(line); |
|
190 |
contentByte.SetColorFill(colors); |
|
191 |
if ((PaintStyle & PaintSet.Outline) == PaintSet.Outline) |
|
192 |
{ |
|
193 |
contentByte.SetColorStroke(bs); |
|
194 |
contentByte.ClosePathFillStroke(); |
|
195 |
} |
|
196 |
else |
|
197 |
contentByte.Fill(); |
|
198 |
} |
|
199 |
|
|
200 |
if (PaintStyle == PaintSet.Outline) |
|
201 |
{ |
|
202 |
contentByte.SetColorStroke(bs); |
|
203 |
contentByte.ClosePathStroke(); |
|
204 |
} |
|
205 |
|
|
206 |
if (PaintStyle == PaintSet.None) |
|
207 |
{ |
|
208 |
contentByte.SetColorStroke(bs); |
|
209 |
contentByte.ClosePathStroke(); |
|
210 |
} |
|
211 |
} |
|
212 |
|
|
213 |
public static Rectangle GetPointsToRectX(List<Point> point) |
|
214 |
{ |
|
215 |
double minX = 0; |
|
216 |
double minY = 0; |
|
217 |
double maxX = 0; |
|
218 |
double maxY = 0; |
|
219 |
|
|
220 |
var xSet = point.Select(data => data.X).ToList(); |
|
221 |
var ySet = point.Select(data => data.Y).ToList(); |
|
222 |
|
|
223 |
minX = xSet.Min(); |
|
224 |
maxX = xSet.Max(); |
|
225 |
minY = ySet.Min(); |
|
226 |
maxY = ySet.Max(); |
|
227 |
|
|
228 |
Rect instance = new Rect(new Point(minX, minY), new Point(maxX, maxY)); |
|
229 |
return new Rectangle(new System.util.RectangleJ((float)instance.X, (float)instance.Y, (float)instance.Width, (float)instance.Height)); |
|
230 |
} |
|
231 |
} |
|
232 |
} |
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/HoneyPDFLib_DrawSet_Arc.cs | ||
---|---|---|
1 |
using iTextSharp.text; |
|
2 |
using iTextSharp.text.pdf; |
|
3 |
using System; |
|
4 |
using System.Collections.Generic; |
|
5 |
using System.Linq; |
|
6 |
using System.Text; |
|
7 |
using System.Windows.Media; |
|
8 |
|
|
9 |
namespace MarkupToPDF.Controls_PDF |
|
10 |
{ |
|
11 |
public class HoneyPDFLib_DrawSet_Arc : BaseMethod |
|
12 |
{ |
|
13 |
public static void DrawArc(System.Windows.Point p1, System.Windows.Point p2, System.Windows.Point p3, int lineSize, PdfContentByte contentByte, |
|
14 |
SolidColorBrush color, double opac) |
|
15 |
{ |
|
16 |
contentByte.SaveState(); |
|
17 |
PdfGState gs1 = new PdfGState(); |
|
18 |
gs1.StrokeOpacity = (float)opac; |
|
19 |
contentByte.SetGState(gs1); |
|
20 |
var rect = contentByte.PdfDocument.PageSize; |
|
21 |
BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A); |
|
22 |
contentByte.SetColorStroke(bs); |
|
23 |
|
|
24 |
contentByte.SetLineWidth((float)lineSize); |
|
25 |
contentByte.NewPath(); |
|
26 |
contentByte.MoveTo((float)p1.X, (float)p1.Y); |
|
27 |
|
|
28 |
if (p2.Y >= p1.Y || p2.Y >= p3.Y) //중간 Mid Point 는 Curve 특성에 대한 10 범위 내의 오차 적용 |
|
29 |
{ |
|
30 |
contentByte.CurveTo((float)p1.X, (float)p1.Y, (float)p2.X, (float)p2.Y + 10, (float)p3.X, (float)p3.Y); |
|
31 |
} |
|
32 |
else |
|
33 |
{ |
|
34 |
contentByte.CurveTo((float)p1.X, (float)p1.Y, (float)p2.X, (float)p2.Y - 10, (float)p3.X, (float)p3.Y); |
|
35 |
} |
|
36 |
|
|
37 |
contentByte.Stroke(); |
|
38 |
contentByte.ClosePath(); |
|
39 |
contentByte.RestoreState(); |
|
40 |
} |
|
41 |
} |
|
42 |
} |
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/HoneyPDFLib_DrawSet_Arrow.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 HoneyPDFLib_DrawSet_Arrow : BaseMethod |
|
14 |
{ |
|
15 |
public static void SingleAllow(System.Windows.Point p1, System.Windows.Point p2, double lineSize, PdfContentByte contentByte, |
|
16 |
SolidColorBrush color, double opac, bool isFixPoint = false) |
|
17 |
{ |
|
18 |
contentByte.SaveState(); |
|
19 |
{ |
|
20 |
PdfGState gs1 = new PdfGState(); |
|
21 |
gs1.StrokeOpacity = (float)opac; |
|
22 |
contentByte.SetGState(gs1); |
|
23 |
var rect = contentByte.PdfDocument.PageSize; |
|
24 |
BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A); |
|
25 |
contentByte.SetColorFill(bs); |
|
26 |
contentByte.SetColorStroke(bs); |
|
27 |
contentByte.SetLineWidth(lineSize); |
|
28 |
|
|
29 |
double l = MathSet.DistanceTo(p1, p2); |
|
30 |
double dx = (p1.X - p2.X) / l; |
|
31 |
double dy = (p1.Y - p2.Y) / l; |
|
32 |
Point norm = MathSet.RotateAbout(new Point(0, 0), new Point(dx, dy), 90); |
|
33 |
|
|
34 |
contentByte.NewPath(); |
|
35 |
|
|
36 |
lineSize = lineSize < 0.3 ? 0.3 : lineSize; |
|
37 |
contentByte.MoveTo(p1.X - dx * 3*lineSize - norm.X * 1*lineSize, p1.Y - dy * 3*lineSize - norm.Y * 1*lineSize); |
|
38 |
contentByte.LineTo(p1.X - dx * 3*lineSize + norm.X * 1*lineSize, p1.Y - dy * 3*lineSize + norm.Y * 1*lineSize); |
|
39 |
contentByte.LineTo(p1.X, p1.Y); |
|
40 |
contentByte.LineTo(p1.X - dx * 3*lineSize - norm.X * 1*lineSize, p1.Y - dy * 3*lineSize - norm.Y * 1*lineSize); |
|
41 |
|
|
42 |
contentByte.ClosePathFillStroke(); |
|
43 |
} |
|
44 |
contentByte.RestoreState(); |
|
45 |
} |
|
46 |
|
|
47 |
public static void DimAllow(System.Windows.Point p1, System.Windows.Point p2, double lineSize, PdfContentByte contentByte, |
|
48 |
SolidColorBrush color, double opac, bool isFixPoint = false) |
|
49 |
{ |
|
50 |
contentByte.SaveState(); |
|
51 |
PdfGState gs1 = new PdfGState(); |
|
52 |
gs1.StrokeOpacity = (float)opac; |
|
53 |
contentByte.SetGState(gs1); |
|
54 |
var rect = contentByte.PdfDocument.PageSize; |
|
55 |
BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A); |
|
56 |
contentByte.SetColorFill(bs); |
|
57 |
contentByte.SetColorStroke(bs); |
|
58 |
//contentByte.SetLineWidth((float)lineSize - 2); |
|
59 |
contentByte.SetLineWidth((float)lineSize); |
|
60 |
|
|
61 |
double theta = Math.Atan2((p2.Y - p1.Y), (p2.X - p1.X)) * 180 / Math.PI; |
|
62 |
|
|
63 |
//iTextSharp.awt.geom.Point startPoint_p1 = new iTextSharp.awt.geom.Point(p1.X - lineSize, p1.Y - lineSize * 2); |
|
64 |
//iTextSharp.awt.geom.Point endPoint_p1 = new iTextSharp.awt.geom.Point(p1.X - lineSize, p1.Y + lineSize * 2); |
|
65 |
|
|
66 |
//iTextSharp.awt.geom.Point startPoint_p2 = new iTextSharp.awt.geom.Point(p2.X + lineSize, p2.Y - lineSize * 2); |
|
67 |
//iTextSharp.awt.geom.Point endPoint_p2 = new iTextSharp.awt.geom.Point(p2.X + lineSize, p2.Y + lineSize * 2); |
|
68 |
|
|
69 |
|
|
70 |
//iTextSharp.awt.geom.Point startPoint_p1 = new iTextSharp.awt.geom.Point(p1.X - lineSize, p1.Y - lineSize * 2); |
|
71 |
//iTextSharp.awt.geom.Point endPoint_p1 = new iTextSharp.awt.geom.Point(p1.X - lineSize, p1.Y + lineSize * 2); |
|
72 |
|
|
73 |
//iTextSharp.awt.geom.Point startPoint_p2 = new iTextSharp.awt.geom.Point(p2.X + lineSize, p2.Y - lineSize * 2); |
|
74 |
//iTextSharp.awt.geom.Point endPoint_p2 = new iTextSharp.awt.geom.Point(p2.X + lineSize, p2.Y + lineSize * 2); |
|
75 |
|
|
76 |
iTextSharp.awt.geom.Point startPoint_p1 = new iTextSharp.awt.geom.Point(p1.X - 1, p1.Y - lineSize * 2); |
|
77 |
iTextSharp.awt.geom.Point endPoint_p1 = new iTextSharp.awt.geom.Point(p1.X - 1, p1.Y + lineSize * 2); |
|
78 |
|
|
79 |
iTextSharp.awt.geom.Point startPoint_p2 = new iTextSharp.awt.geom.Point(p2.X + 1, p2.Y - lineSize * 2); |
|
80 |
iTextSharp.awt.geom.Point endPoint_p2 = new iTextSharp.awt.geom.Point(p2.X + 1, p2.Y + lineSize * 2); |
내보내기 Unified diff