프로젝트

일반

사용자정보

개정판 c206d293

IDc206d293a83ae7d06b951f601e5d0116f242e8d9
상위 872b94b9
하위 24c5e56c

김태성이(가) 4년 이상 전에 추가함

- final service
: font 추가

Change-Id: If1a85790055b42b90f397f4e2054acc320c1ed30

차이점 보기:

ConvertService/ServiceController/StationControllerService/Web.config
49 49
    </providers>
50 50
  </entityFramework>
51 51
  <connectionStrings>
52
    <!--doftech Connection String-->
52
    <!--효성 Connection String-->
53 53
    <add name="markusEntities"
54
      connectionString="metadata=res://*/MarkusModel.csdl|res://*/MarkusModel.ssdl|res://*/MarkusModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=192.168.0.67;initial catalog=markus;persist security info=True;user id=doftech;password=dof1073#;multipleactiveresultsets=True;application name=EntityFramework&quot;"
54
      connectionString="metadata=res://*/MarkusModel.csdl|res://*/MarkusModel.ssdl|res://*/MarkusModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=10.11.252.2,9875;initial catalog=markus;persist security info=True;user id=ProjectPortalDBConn;password=ProjectPortalDBConn;multipleactiveresultsets=True;application name=EntityFramework&quot;"
55 55
      providerName="System.Data.EntityClient"/>
56 56
  </connectionStrings>
57 57
</configuration>
FinalService/KCOM_FinalService/FinalPDFClient/FinalPDFClient.csproj
67 67
      <DependentUpon>MainWindow.xaml</DependentUpon>
68 68
      <SubType>Code</SubType>
69 69
    </Compile>
70
    <None Include="Themes\Generic.xaml">
71
      <Generator>MSBuild:Compile</Generator>
72
      <SubType>Designer</SubType>
73
    </None>
74
    <None Include="Window1.xaml">
75
      <SubType>Designer</SubType>
76
      <Generator>MSBuild:Compile</Generator>
77
    </None>
70 78
  </ItemGroup>
71 79
  <ItemGroup>
72 80
    <Compile Include="Properties\AssemblyInfo.cs">
FinalService/KCOM_FinalService/FinalPDFClient/MainWindow.xaml
32 32
                <TextBlock Text="Document ID : "/>
33 33
                <TextBox Name="txtDocId" Width="120" Text="30000165"/>
34 34
            </StackPanel>
35
            <StackPanel Orientation="Horizontal" Grid.Row="3" Grid.ColumnSpan="3" HorizontalAlignment="Left">
35
            <Grid  Grid.Row="3" Grid.ColumnSpan="3">
36
                <Grid.ColumnDefinitions>
37
                    <ColumnDefinition Width="Auto"/>
38
                    <ColumnDefinition/>
39
                </Grid.ColumnDefinitions>
36 40
                <TextBlock Text="Output : "/>
37
                <TextBox Name="txtOutput" Width="300" Text=""/>
38
            </StackPanel>
41
                <TextBox Name="txtOutput" Grid.Column="1" Text=""/>
42
            </Grid>
39 43
            <Button Grid.Row="4" Content="Merged PDF" Margin="2" Width="100" Click="Button_Click"/>
44
            <Button Grid.Row="4" Grid.Column="1" Content="Xaml To String" Margin="2" Width="100" Click="btXamlToString_Click"/>
40 45
        </Grid>
41 46
    </Grid>
42 47
</Window>
FinalService/KCOM_FinalService/FinalPDFClient/MainWindow.xaml.cs
1 1
using KCOMDataModel.DataModel;
2 2
using MarkupToPDF;
3
using Microsoft.Win32;
3 4
using System;
4 5
using System.Collections.Generic;
6
using System.IO;
5 7
using System.Linq;
6 8
using System.Text;
7 9
using System.Threading.Tasks;
......
27 29
            InitializeComponent();
28 30
        }
29 31

  
30
        public void MergedPDF()
32
        public  void MergedPDF()
31 33
        {
34

  
35
            System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
36
            stopwatch.Start();
37

  
32 38
            MarkupToPDF.MarkupToPDF markupToPDF = new MarkupToPDF.MarkupToPDF();
33 39

  
34 40
            EventHandler<MakeFinalErrorArgs> errorEventHandler = null;
35 41
            EventHandler<EndFinalEventArgs> endFinalEventHandler = null;
36 42
            EventHandler<StatusChangedEventArgs> StatusChangedEventHandler = null;
37 43

  
38
            errorEventHandler = (snd, evt) =>
44
            errorEventHandler = async (snd, evt) =>
39 45
            {
40
                System.Diagnostics.Debug.WriteLine(evt.Message);
46
                await this.Dispatcher.InvokeAsync(() =>
47
                {
48
                    txtOutput.Text += evt.Message;
41 49

  
42
                markupToPDF.FinalMakeError -= errorEventHandler;
43
                markupToPDF.EndFinal -= endFinalEventHandler;
44
                markupToPDF.StatusChanged -= StatusChangedEventHandler;
50
                    markupToPDF.FinalMakeError -= errorEventHandler;
51
                    markupToPDF.EndFinal -= endFinalEventHandler;
52
                    markupToPDF.StatusChanged -= StatusChangedEventHandler;
53
                });
45 54
            };
46 55

  
47
            endFinalEventHandler = (snd, evt) =>
56
            endFinalEventHandler = async (snd, evt) =>
48 57
            {
49
                txtOutput.Text += evt.FinalPDFPath + "     "  + evt.Error;
50
                System.Diagnostics.Debug.WriteLine(evt.Message);
58
                await this.Dispatcher.InvokeAsync(() =>
59
                {
60
                    txtOutput.Text += evt.FinalPDFPath + "     " + evt.Error;
61
                    System.Diagnostics.Debug.WriteLine(evt.Message);
51 62

  
52
                markupToPDF.FinalMakeError -= errorEventHandler;
53
                markupToPDF.EndFinal -= endFinalEventHandler;
54
                markupToPDF.StatusChanged -= StatusChangedEventHandler;
63
                    var sb = new StringBuilder();
64
                    sb.AppendLine(txtOutput.Text);
65
                    sb.AppendLine(new TimeSpan(stopwatch.ElapsedMilliseconds).ToString());
66
                    txtOutput.Text = sb.ToString();
67

  
68
                    markupToPDF.FinalMakeError -= errorEventHandler;
69
                    markupToPDF.EndFinal -= endFinalEventHandler;
70
                    markupToPDF.StatusChanged -= StatusChangedEventHandler;
71
                });
55 72
            };
56 73

  
57
            StatusChangedEventHandler = (snd, evt) =>
74
            StatusChangedEventHandler = async (snd, evt) =>
58 75
            {
59
                txtOutput.Dispatcher.Invoke(() => {
76
                await this.Dispatcher.InvokeAsync(() => {
60 77
                    txtOutput.Text += evt.Message + " " + evt.CurrentPage + "  " + evt.Error;
61 78
                });
62 79
            };
......
71 88
                if (addResult.Success)
72 89
                {
73 90
                    markupToPDF.MakeFinalPDF((object)addResult.FinalPDF);
91
                  
92

  
74 93
                }
75 94
            }
76 95
            catch (Exception ex)
......
81 100

  
82 101
        private void Button_Click(object sender, RoutedEventArgs e)
83 102
        {
84
            MergedPDF();
103
             MergedPDF();
85 104
        }
86 105

  
106
        private void btXamlToString_Click(object sender, RoutedEventArgs e)
107
        {
108
            OpenFileDialog openFileDialog = new OpenFileDialog();
109

  
110
            openFileDialog.InitialDirectory = "c:\\";
111
            openFileDialog.Filter = "xaml files (*.xaml)|*.txt|All files (*.*)|*.*";
112
            openFileDialog.FilterIndex = 2;
113
            openFileDialog.RestoreDirectory = true;
114

  
115
            if (openFileDialog.ShowDialog() == true)
116
            {
117
                //Read the contents of the file into a stream
118
                var fileStream = openFileDialog.OpenFile();
119

  
120
                using (StreamReader reader = new StreamReader(fileStream))
121
                {
122
                    string fileContent = reader.ReadToEnd();
123

  
124
                    MarkupToPDF.MarkupToPDF markupToPDF = new MarkupToPDF.MarkupToPDF();
125

  
126
                    markupToPDF.AddStamp(fileContent);
127
                }
128
            }
129

  
130
        }
87 131
    }
88 132
}
FinalService/KCOM_FinalService/FinalPDFClient/Themes/Generic.xaml
1
<ResourceDictionary
2
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4
    xmlns:local="clr-namespace:FinalPDFClient">
5

  
6

  
7
    <Style TargetType="{x:Type local:CustomControl1}">
8
        <Setter Property="Template">
9
            <Setter.Value>
10
                <ControlTemplate TargetType="{x:Type local:CustomControl1}">
11
                    <Border Background="{TemplateBinding Background}"
12
                            BorderBrush="{TemplateBinding BorderBrush}"
13
                            BorderThickness="{TemplateBinding BorderThickness}">
14
                    </Border>
15
                </ControlTemplate>
16
            </Setter.Value>
17
        </Setter>
18
    </Style>
19
</ResourceDictionary>
FinalService/KCOM_FinalService/FinalPDFClient/Window1.xaml
1
    <Grid Name="aaaaaa" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Width="205" Height="89">
2
        <Grid.Background>
3
            <SolidColorBrush Color="#FFFFFFFF" Opacity="0.1" />
4
        </Grid.Background>
5
        <Rectangle Stretch="Fill" Stroke="#FFFF0000" StrokeThickness="5" StrokeLineJoin="Round" Name="Rectangle" Width="205" Height="89" Canvas.Left="-2.5" Canvas.Top="-2.5" />
6
        <Grid>
7
            <Grid.RowDefinitions>
8
                <RowDefinition Height="*" />
9
                <RowDefinition Height="3.5*" />
10
                <RowDefinition Height="0.5*" />
11
                <RowDefinition Height="2*" />
12
                <RowDefinition Height="*" />
13
            </Grid.RowDefinitions>
14
            <TextBlock Text="APPROVED" FontWeight="ExtraBold" FontSize="30" Foreground="#FFFF0000" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="1" />
15
            <TextBlock Text="By HYOSUNG" FontWeight="ExtraBold" FontSize="20" Foreground="#FFFF0000" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="3" />
16
        </Grid>
17
    </Grid>
FinalService/KCOM_FinalService/KCOM_FinalService.sln
29 29
EndProject
30 30
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FinalPDFClient", "FinalPDFClient\FinalPDFClient.csproj", "{DBD7598F-130F-4605-9B11-FE955A59FD4A}"
31 31
EndProject
32
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Markus.Fonts", "Markus.Fonts\Markus.Fonts.csproj", "{EB1DE04A-D86E-4BF7-B095-F72207923C3B}"
33
EndProject
32 34
Global
33 35
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
34 36
		Debug|Any CPU = Debug|Any CPU
......
169 171
		{DBD7598F-130F-4605-9B11-FE955A59FD4A}.Release|x64.Build.0 = Release|Any CPU
170 172
		{DBD7598F-130F-4605-9B11-FE955A59FD4A}.Release|x86.ActiveCfg = Release|Any CPU
171 173
		{DBD7598F-130F-4605-9B11-FE955A59FD4A}.Release|x86.Build.0 = Release|Any CPU
174
		{EB1DE04A-D86E-4BF7-B095-F72207923C3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
175
		{EB1DE04A-D86E-4BF7-B095-F72207923C3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
176
		{EB1DE04A-D86E-4BF7-B095-F72207923C3B}.Debug|x64.ActiveCfg = Debug|Any CPU
177
		{EB1DE04A-D86E-4BF7-B095-F72207923C3B}.Debug|x64.Build.0 = Debug|Any CPU
178
		{EB1DE04A-D86E-4BF7-B095-F72207923C3B}.Debug|x86.ActiveCfg = Debug|Any CPU
179
		{EB1DE04A-D86E-4BF7-B095-F72207923C3B}.Debug|x86.Build.0 = Debug|Any CPU
180
		{EB1DE04A-D86E-4BF7-B095-F72207923C3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
181
		{EB1DE04A-D86E-4BF7-B095-F72207923C3B}.Release|Any CPU.Build.0 = Release|Any CPU
182
		{EB1DE04A-D86E-4BF7-B095-F72207923C3B}.Release|x64.ActiveCfg = Release|Any CPU
183
		{EB1DE04A-D86E-4BF7-B095-F72207923C3B}.Release|x64.Build.0 = Release|Any CPU
184
		{EB1DE04A-D86E-4BF7-B095-F72207923C3B}.Release|x86.ActiveCfg = Release|Any CPU
185
		{EB1DE04A-D86E-4BF7-B095-F72207923C3B}.Release|x86.Build.0 = Release|Any CPU
172 186
	EndGlobalSection
173 187
	GlobalSection(SolutionProperties) = preSolution
174 188
		HideSolutionNode = FALSE
FinalService/KCOM_FinalService/KcomDataService/DataService.svc
1
<%@ ServiceHost Language="C#" Debug="true" Service="KcomDataService.DataService" CodeBehind="DataService.svc.cs" %>
FinalService/KCOM_FinalService/KcomDataService/DataService.svc.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Runtime.Serialization;
5
using System.ServiceModel;
6
using System.ServiceModel.Web;
7
using System.Text;
8

  
9
namespace KcomDataService
10
{
11
    [ServiceContract]
12
    public class DataService
13
    {
14
        KCOMDataModel.DataModel.CIEntities ciEntities = null;
15
        KCOMDataModel.DataModel.KCOMEntities kcomEntities = null;
16

  
17
        public DataService()
18
        {
19
            ciEntities = new KCOMDataModel.DataModel.CIEntities();
20
            kcomEntities = new KCOMDataModel.DataModel.KCOMEntities();
21
        }
22

  
23
        [OperationContract]
24
        public string GetData(int value)
25
        {
26
            return "";
27
        }
28
    }
29
}
FinalService/KCOM_FinalService/KcomDataService/KcomDataService.csproj
1
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
3
  <PropertyGroup>
4
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6
    <ProductVersion>
7
    </ProductVersion>
8
    <SchemaVersion>2.0</SchemaVersion>
9
    <ProjectGuid>{981AD841-0627-4485-A54D-DFBB4E9A9BFF}</ProjectGuid>
10
    <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
11
    <OutputType>Library</OutputType>
12
    <AppDesignerFolder>Properties</AppDesignerFolder>
13
    <RootNamespace>KcomDataService</RootNamespace>
14
    <AssemblyName>KcomDataService</AssemblyName>
15
    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
16
    <WcfConfigValidationEnabled>True</WcfConfigValidationEnabled>
17
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
18
    <UseIISExpress>true</UseIISExpress>
19
    <Use64BitIISExpress />
20
    <IISExpressSSLPort />
21
    <IISExpressAnonymousAuthentication />
22
    <IISExpressWindowsAuthentication />
23
    <IISExpressUseClassicPipelineMode />
24
    <UseGlobalApplicationHostFile />
25
  </PropertyGroup>
26
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
27
    <DebugSymbols>true</DebugSymbols>
28
    <DebugType>full</DebugType>
29
    <Optimize>false</Optimize>
30
    <OutputPath>bin\</OutputPath>
31
    <DefineConstants>DEBUG;TRACE</DefineConstants>
32
    <ErrorReport>prompt</ErrorReport>
33
    <WarningLevel>4</WarningLevel>
34
  </PropertyGroup>
35
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
36
    <DebugType>pdbonly</DebugType>
37
    <Optimize>true</Optimize>
38
    <OutputPath>bin\</OutputPath>
39
    <DefineConstants>TRACE</DefineConstants>
40
    <ErrorReport>prompt</ErrorReport>
41
    <WarningLevel>4</WarningLevel>
42
  </PropertyGroup>
43
  <ItemGroup>
44
    <Reference Include="Microsoft.CSharp" />
45
    <Reference Include="System.Web.DynamicData" />
46
    <Reference Include="System.Web.Entity" />
47
    <Reference Include="System.Web.ApplicationServices" />
48
    <Reference Include="System" />
49
    <Reference Include="System.Configuration" />
50
    <Reference Include="System.Core" />
51
    <Reference Include="System.Data" />
52
    <Reference Include="System.Drawing" />
53
    <Reference Include="System.EnterpriseServices" />
54
    <Reference Include="System.Runtime.Serialization" />
55
    <Reference Include="System.ServiceModel" />
56
    <Reference Include="System.ServiceModel.Web" />
57
    <Reference Include="System.Web" />
58
    <Reference Include="System.Web.Extensions" />
59
    <Reference Include="System.Web.Services" />
60
    <Reference Include="System.Xml" />
61
    <Reference Include="System.Xml.Linq" />
62
  </ItemGroup>
63
  <ItemGroup>
64
    <Content Include="DataService.svc" />
65
    <Content Include="Web.config" />
66
  </ItemGroup>
67
  <ItemGroup>
68
    <Compile Include="DataService.svc.cs">
69
      <DependentUpon>DataService.svc</DependentUpon>
70
    </Compile>
71
    <Compile Include="Properties\AssemblyInfo.cs" />
72
  </ItemGroup>
73
  <ItemGroup>
74
    <ProjectReference Include="..\KCOMDataModel\KCOMDataModel.csproj">
75
      <Project>{629dc8cd-d458-47ef-8f02-cd12c7001c3e}</Project>
76
      <Name>KCOMDataModel</Name>
77
    </ProjectReference>
78
  </ItemGroup>
79
  <ItemGroup>
80
    <None Include="Web.Debug.config">
81
      <DependentUpon>Web.config</DependentUpon>
82
    </None>
83
    <None Include="Web.Release.config">
84
      <DependentUpon>Web.config</DependentUpon>
85
    </None>
86
  </ItemGroup>
87
  <PropertyGroup>
88
    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
89
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
90
  </PropertyGroup>
91
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
92
  <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
93
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
94
  <ProjectExtensions>
95
    <VisualStudio>
96
      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
97
        <WebProjectProperties>
98
          <UseIIS>True</UseIIS>
99
          <AutoAssignPort>True</AutoAssignPort>
100
          <DevelopmentServerPort>57488</DevelopmentServerPort>
101
          <DevelopmentServerVPath>/</DevelopmentServerVPath>
102
          <IISUrl>http://localhost:56486/</IISUrl>
103
          <NTLMAuthentication>False</NTLMAuthentication>
104
          <UseCustomServer>False</UseCustomServer>
105
          <CustomServerUrl>
106
          </CustomServerUrl>
107
          <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
108
        </WebProjectProperties>
109
      </FlavorProperties>
110
    </VisualStudio>
111
  </ProjectExtensions>
112
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
113
       Other similar extension points exist, see Microsoft.Common.targets.
114
  <Target Name="BeforeBuild">
115
  </Target>
116
  <Target Name="AfterBuild">
117
  </Target>
118
  -->
119
</Project>
FinalService/KCOM_FinalService/KcomDataService/Properties/AssemblyInfo.cs
1
using System.Reflection;
2
using System.Runtime.CompilerServices;
3
using System.Runtime.InteropServices;
4

  
5
// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해 
6
// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
7
// 이러한 특성 값을 변경하세요.
8
[assembly: AssemblyTitle("KcomDataService")]
9
[assembly: AssemblyDescription("")]
10
[assembly: AssemblyConfiguration("")]
11
[assembly: AssemblyCompany("")]
12
[assembly: AssemblyProduct("KcomDataService")]
13
[assembly: AssemblyCopyright("Copyright ©  2020")]
14
[assembly: AssemblyTrademark("")]
15
[assembly: AssemblyCulture("")]
16

  
17
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에 
18
// 표시되지 않습니다.  COM에서 이 어셈블리의 형식에 액세스하려면 
19
// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
20
[assembly: ComVisible(false)]
21

  
22
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
23
[assembly: Guid("981ad841-0627-4485-a54d-dfbb4e9a9bff")]
24

  
25
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
26
//
27
//      주 버전
28
//      부 버전 
29
//      빌드 번호
30
//      수정 버전
31
//
32
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 수정 버전 및 빌드 번호가 자동으로 
33
// 지정되도록 할 수 있습니다.
34
// [assembly: AssemblyVersion("1.0.*")]
35
[assembly: AssemblyVersion("1.0.0.0")]
36
[assembly: AssemblyFileVersion("1.0.0.0")]
FinalService/KCOM_FinalService/KcomDataService/Web.Debug.config
1
<?xml version="1.0" encoding="utf-8"?>
2

  
3
<!-- web.config 변환 사용에 대한 자세한 내용은 https://go.microsoft.com/fwlink/?LinkId=125889를 참조하세요. -->
4

  
5
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
6
  <!--
7
    아래 예에서, "Match" 로케이터가 "MyDB" 값을 가진 "name" 특성을 
8
 찾은 경우에만 "SetAttributes" 변환에서 "ReleaseSQLServer"를 
9
 사용하도록 "connectionString"의 값을 변경합니다.
10
    
11
    <connectionStrings>
12
      <add name="MyDB" 
13
        connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True" 
14
        xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
15
    </connectionStrings>
16
  -->
17
  <system.web>
18
    <!--
19
      
20
      아래 예에서 "Replace" 변환은 web.config 파일의 
21
      <customErrors> 섹션 전체를 바꿉니다.
22
      <system.web> 노드 아래에는 customErrors 섹션이 하나만 있기 때문에 
23
      "xdt:Locator" 특성을 사용할 필요가 없습니다.
24
      
25
      <customErrors defaultRedirect="GenericError.htm"
26
        mode="RemoteOnly" xdt:Transform="Replace">
27
        <error statusCode="500" redirect="InternalError.htm"/>
28
      </customErrors>
29
    >
30
    -->
31
  </system.web>
32
</configuration>
FinalService/KCOM_FinalService/KcomDataService/Web.Release.config
1
<?xml version="1.0" encoding="utf-8"?>
2

  
3
<!-- web.config 변환 사용에 대한 자세한 내용은 https://go.microsoft.com/fwlink/?LinkId=125889를 참조하세요. -->
4

  
5
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
6
  <!--
7
    아래 예에서, "Match" 로케이터가 "MyDB" 값을 가진 "name" 특성을 
8
 찾은 경우에만 "SetAttributes" 변환에서 "ReleaseSQLServer"를 
9
 사용하도록 "connectionString"의 값을 변경합니다.
10
    
11
    <connectionStrings>
12
      <add name="MyDB" 
13
        connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True" 
14
        xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
15
    </connectionStrings>
16
  -->
17
  <system.web>
18
    <compilation xdt:Transform="RemoveAttributes(debug)" />
19
    <!--
20
      
21
      아래 예에서 "Replace" 변환은 web.config 파일의 
22
      <customErrors> 섹션 전체를 바꿉니다.
23
      <system.web> 노드 아래에는 customErrors 섹션이 하나만 있기 때문에 
24
      "xdt:Locator" 특성을 사용할 필요가 없습니다.
25
      
26
      <customErrors defaultRedirect="GenericError.htm"
27
        mode="RemoteOnly" xdt:Transform="Replace">
28
        <error statusCode="500" redirect="InternalError.htm"/>
29
      </customErrors>
30
    >
31
    -->
32
  </system.web>
33
</configuration>
FinalService/KCOM_FinalService/KcomDataService/Web.config
1
<?xml version="1.0" encoding="utf-8"?>
2
<configuration>
3

  
4
  <appSettings>
5
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
6
  </appSettings>
7
  <system.web>
8
    <compilation debug="true" targetFramework="4.6.1" />
9
    <httpRuntime targetFramework="4.6.1"/>
10
  </system.web>
11
  <system.serviceModel>
12
    <behaviors>
13
      <serviceBehaviors>
14
        <behavior>
15
          <!-- 메타데이터 정보를 공개하지 않으려면 배포하기 전에 아래 값을 false로 설정하십시오. -->
16
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
17
          <!-- 디버깅 목적으로 오류에서 예외 정보를 받으려면 아래의 값을 true로 설정하십시오. 예외 정보를 공개하지 않으려면 배포하기 전에 false로 설정하십시오. -->
18
          <serviceDebug includeExceptionDetailInFaults="false"/>
19
        </behavior>
20
      </serviceBehaviors>
21
    </behaviors>
22
    <protocolMapping>
23
        <add binding="basicHttpsBinding" scheme="https" />
24
    </protocolMapping>    
25
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
26
  </system.serviceModel>
27
  <system.webServer>
28
    <modules runAllManagedModulesForAllRequests="true"/>
29
    <!--
30
        디버깅 중에 웹 응용 프로그램 루트 디렉터리를 찾으려면 아래 값을 true로 설정하십시오.
31
        웹 응용 프로그램 폴더 정보를 공개하지 않으려면 배포 전에 false로 설정하십시오.
32
      -->
33
    <directoryBrowse enabled="true"/>
34
  </system.webServer>
35

  
36
</configuration>
FinalService/KCOM_FinalService/MarkupToPDF/Common/CommonFont.cs
1
using iTextSharp.text.pdf;
2
using MarkusFont = Markus.Fonts;
3
using System;
4
using System.Collections.Generic;
5
using System.IO;
6
using System.Linq;
7
using System.Text;
8
using System.Windows;
9
using System.Windows.Media;
10

  
11
namespace MarkupToPDF.Common
12
{
13
    public static class CommonFont
14
    {
15
        public static BaseFont CreateBaseFont(string name, string encoding, bool embedded, bool cached,Stream fontStream, byte[] pfb)
16
        {
17
            var fontBytes = fontStream.ReadFully();
18
            return BaseFont.CreateFont(name, encoding, embedded,cached, fontBytes, pfb);
19
        }
20

  
21
        public static BaseFont CreateBaseFont(System.Windows.Media.FontFamily fontFamily, string encoding, bool embedded, bool cached)
22
        {
23
            var fileName = MarkusFont.FontDictionary.GetMarkusFont(fontFamily).FileName;
24

  
25
            return CreateBaseFont(fileName, encoding, embedded, cached);
26
        }
27

  
28
        public static BaseFont CreateBaseFont(string Name, string encoding, bool embedded, bool cached)
29
        {
30
            try
31
            {
32
                var fontStream = MarkusFont.FontHelper.GetFontStream(Name);
33

  
34
                var fontBytes = fontStream.ReadFully();
35
                return BaseFont.CreateFont(Name, encoding, embedded, cached, fontBytes, null);
36
            }
37
            catch (Exception)
38
            {
39
                throw new Exception($"CreateBaseFont Font {Name} Error" );
40
            }
41
        }
42

  
43
        /// <summary>
44
        /// create a font with given parameters
45
        /// </summary>
46
        /// <param name="fontstyle"></param>
47
        /// <param name="fontweight"></param>
48
        /// <param name="isUnderline"></param>
49
        /// <param name="rect"></param>
50
        /// <param name="text"></param>
51
        /// <returns></returns>
52
        public static iTextSharp.text.Font CreateFont(FontFamily fontFamilly, FontStyle fontstyle, FontWeight fontweight, TextDecorationCollection isUnderline, iTextSharp.text.Rectangle rect, string text)
53
        {
54
            ///int iFonts = FontFactory.RegisterDirectory(Environment.GetFolderPath(Environment.SpecialFolder.Fonts));
55
            //string sFontPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "Arial Unicode MS.TTF");
56

  
57
            //bool bTextIsAscii = !text.Any(c => !Char.IsLetterOrDigit(c));   /// text가 ascii인지 확인
58
            //if (bTextIsAscii)
59
            //{
60
            //    sFontPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "TIMES.TTF");
61
            //}
62
            
63
            double dFontSize = double.MaxValue;
64

  
65
            BaseFont bf = CreateBaseFont(fontFamilly,BaseFont.IDENTITY_H, BaseFont.EMBEDDED, BaseFont.CACHED);
66

  
67
            string[] tokens = text.Split(Environment.NewLine.ToArray(), StringSplitOptions.RemoveEmptyEntries);
68
            foreach (var token in tokens)
69
            {
70
                float width = bf.GetWidthPoint(token, rect.Height);
71
                double ratio = rect.Width / width;
72
                double size = rect.Height * ratio;
73
                dFontSize = size < dFontSize ? size : dFontSize;
74
            }
75
            
76
            iTextSharp.text.Font itextFont = new iTextSharp.text.Font(bf, (float)(dFontSize));
77

  
78
            itextFont.SetStyle(0);
79
            if (fontstyle == FontStyles.Italic)
80
            {
81
                //기울임
82
                itextFont.SetStyle(itextFont.Style | iTextSharp.text.Font.ITALIC);
83
            }
84
            if (fontweight == FontWeights.Bold)
85
            {
86
                //굵기
87
                itextFont.SetStyle(itextFont.Style | iTextSharp.text.Font.BOLD);
88
            }
89

  
90
            if (isUnderline == TextDecorations.Underline)
91
            {
92
                //밑줄;
93
                itextFont.SetStyle(itextFont.Style | iTextSharp.text.Font.UNDERLINE);
94
            }
95

  
96
            return itextFont;
97
        }
98

  
99
        public static byte[] ReadFully(this Stream input)
100
        {
101
            using (MemoryStream ms = new MemoryStream())
102
            {
103
                input.Position = 0;
104

  
105
                input.CopyTo(ms);
106
                return ms.ToArray();
107
            }
108
        }
109
    }
110
}
FinalService/KCOM_FinalService/MarkupToPDF/Common/StreamHelper.cs
1
using System;
2
using System.Collections.Generic;
3
using System.IO;
4
using System.Linq;
5
using System.Text;
6

  
7
namespace MarkupToPDF.Common
8
{
9
    public static class StreamHelper
10
    {
11
        public static Stream GenerateStreamFromString(string s)
12
        {
13
            return new MemoryStream(Encoding.UTF8.GetBytes(s));
14
        }
15
    }
16
}
FinalService/KCOM_FinalService/MarkupToPDF/Common/XamlToPngConverter.cs
1

2
using System;
3
using System.Collections.Generic;
4
using System.IO;
5
using System.Reflection;
6
using System.Threading;
7
using System.Windows;
8
using System.Windows.Markup;
9
using System.Windows.Media;
10
using System.Windows.Media.Imaging;
11

  
12

  
13
namespace XAMLtoPNG
14
{
15
  public enum ScaleTO
16
  {
17
    OriginalSize=1,
18
    TargetSize=2
19
  }
20

  
21
  /// <summary>
22
  /// Source: http://blog.galasoft.ch/archive/2008/10/10/converting-and-customizing-xaml-to-png-with-server-side-wpf.aspx
23
  /// </summary>
24
  public class XamlToPngConverter
25
  {
26
    public void Convert(Stream xamlInput,
27
      double width, 
28
      double height,
29
      double dpiX,
30
      double dpiY,
31
      ScaleTO thisScale,
32
      Stream pngOutput)
33
    {
34
      try
35
      {
36
        // Round width and height to simplify
37
        width = Math.Round(width);
38
        height = Math.Round(height);
39

  
40
        Thread pngCreationThread = new Thread((ThreadStart) delegate()
41
        {
42
          FrameworkElement element = null;
43

  
44
          try
45
          {
46
            var inputElement = XamlReader.Load(xamlInput) as FrameworkElement;
47

  
48
            var viewbox = new System.Windows.Controls.Viewbox();
49
            viewbox.Stretch = Stretch.Fill;
50
            viewbox.Child = inputElement;
51
            viewbox.Width = width;
52
            viewbox.Height = height;
53

  
54
            element = viewbox;
55
          }
56
          catch (XamlParseException)
57
          {
58
          }
59

  
60
          if (element != null)
61
          {
62
            Size renderingSize = new Size(width, height);
63
            element.Measure(renderingSize);
64
            Rect renderingRectangle = new Rect(renderingSize);
65
            element.Arrange(renderingRectangle);
66

  
67
            BitmapSource xamlBitmap = RenderToBitmap(element, width, height, dpiX, dpiY, thisScale);
68
            try
69
            {
70
              PngBitmapEncoder enc = new PngBitmapEncoder();
71
              enc.Frames.Add(BitmapFrame.Create(xamlBitmap));
72
              enc.Save(pngOutput);
73
            }
74
            catch (ObjectDisposedException)
75
            {
76
              // IF the operation lasted too long, the object might be disposed already
77
            }
78
          }
79
        });
80

  
81
        pngCreationThread.IsBackground = true;
82
        pngCreationThread.SetApartmentState(ApartmentState.STA);
83
        pngCreationThread.Start();
84
        pngCreationThread.Join();
85
      }
86
      catch (Exception Exp)
87
      {
88
        throw Exp;
89
      }
90

  
91
      try
92
      {
93
        if (pngOutput.Length == 0)
94
        {
95
          throw new TimeoutException();
96
        }
97
      }
98
      catch (ObjectDisposedException)
99
      {
100
        // If the object was disposed, it means that the Stream is ready.
101
      }
102
    }
103

  
104
    private BitmapSource RenderToBitmap(FrameworkElement target,
105
                                        double width, 
106
                                        double height,
107
                                        double dpiX,
108
                                        double dpiY,
109
                                        ScaleTO thisScale)
110
    {
111
      Rect bounds;
112

  
113
      switch (thisScale)
114
      {
115
        case ScaleTO.OriginalSize:
116
          bounds = VisualTreeHelper.GetDescendantBounds(target);
117
          break;
118
        case ScaleTO.TargetSize:
119
          bounds = new Rect(0, 0, width,height);
120
          break;
121
        default:
122
          throw new ArgumentException(string.Format("The scaling mode: {0} is not supported.", thisScale.ToString()));
123
      }
124

  
125
      RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int) target.ActualWidth,
126
        (int)target.ActualHeight, dpiX, dpiY, PixelFormats.Pbgra32);
127

  
128
      DrawingVisual visual = new DrawingVisual();
129
      using (DrawingContext context = visual.RenderOpen())
130
      {
131
        VisualBrush brush = new VisualBrush(target);
132
        context.DrawRectangle(brush, null, new Rect(new Point(), bounds.Size));
133
      }
134

  
135
      renderBitmap.Render(visual);
136
      return renderBitmap;
137
    }
138
  }
139
}
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/DrawSet_Arc.cs
1 1
using iTextSharp.text;
2 2
using iTextSharp.text.pdf;
3
using MarkupToPDF.Controls.Common;
3 4
using System;
4 5
using System.Collections.Generic;
5 6
using System.Linq;
6 7
using System.Text;
8
using System.Windows;
7 9
using System.Windows.Media;
8 10

  
9 11
namespace MarkupToPDF.Controls_PDF
10 12
{
11 13
    public class DrawSet_Arc : BaseMethod
12 14
    {
13
        public static void DrawArc(System.Windows.Point p1, System.Windows.Point p2, System.Windows.Point p3, int lineSize, PdfContentByte contentByte,
15
        public static void DrawArc(System.Windows.Point p1, System.Windows.Point p2, System.Windows.Point p3, double lineSize, PdfContentByte contentByte,
14 16
                                   SolidColorBrush color, double opac)
15 17
        {
16 18
            contentByte.SaveState();
......
19 21
            contentByte.SetGState(gs1);
20 22
            var rect = contentByte.PdfDocument.PageSize;
21 23
            BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A);
22
            contentByte.SetColorStroke(bs);
23 24

  
25
            contentByte.SetColorStroke(bs);
24 26
            contentByte.SetLineWidth((float)lineSize);
25 27
            contentByte.NewPath();
28

  
29

  
26 30
            contentByte.MoveTo((float)p1.X, (float)p1.Y);
27 31

  
28 32
            if (p2.Y >= p1.Y || p2.Y >= p3.Y)  //중간 Mid Point 는 Curve 특성에 대한 10 범위 내의 오차 적용
......
36 40

  
37 41
            contentByte.Stroke();
38 42
            contentByte.ClosePath();
43

  
39 44
            contentByte.RestoreState();
40 45
        }
41 46
    }
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/DrawSet_ArcArrow.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_ArcArrow : BaseMethod
14
    {
15
        public static void DrawArcArrow(System.Windows.Point p1, System.Windows.Point p2, System.Windows.Point p3, double lineSize, PdfContentByte contentByte,
16
                                   SolidColorBrush color, double opac)
17
        {
18
            contentByte.SaveState();
19
            PdfGState gs1 = new PdfGState();
20
            gs1.StrokeOpacity = (float)opac;
21
            contentByte.SetGState(gs1);
22
            var rect = contentByte.PdfDocument.PageSize;
23
            BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A);
24

  
25
            contentByte.SetColorStroke(bs);
26
            contentByte.SetLineWidth((float)lineSize);
27
            contentByte.NewPath();
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
            contentByte.MoveTo((float)p1.X, (float)p1.Y);
37

  
38
            lineSize = lineSize < 0.3 ? 0.3 : lineSize;
39
            contentByte.MoveTo(p1.X - dx * 3 * lineSize - norm.X * 1 * lineSize, p1.Y - dy * 3 * lineSize - norm.Y * 1 * lineSize);
40
            contentByte.LineTo(p1.X - dx * 3 * lineSize + norm.X * 1 * lineSize, p1.Y - dy * 3 * lineSize + norm.Y * 1 * lineSize);
41
            contentByte.LineTo(p1.X - dx * 3 * lineSize - norm.X * 1 * lineSize, p1.Y - dy * 3 * lineSize - norm.Y * 1 * lineSize);
42

  
43
            if (p2.Y >= p1.Y || p2.Y >= p3.Y)  //중간 Mid Point 는 Curve 특성에 대한 10 범위 내의 오차 적용
44
            {
45
                contentByte.CurveTo((float)p1.X, (float)p1.Y, (float)p2.X, (float)p2.Y + 10, (float)p3.X, (float)p3.Y);
46
            }
47
            else
48
            {
49
                contentByte.CurveTo((float)p1.X, (float)p1.Y, (float)p2.X, (float)p2.Y - 10, (float)p3.X, (float)p3.Y);
50
            }
51

  
52
            contentByte.ClosePathStroke();
53
            contentByte.RestoreState();
54
        }
55
    }
56
}
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/DrawSet_DrawString.cs
1 1
using iTextSharp.text;
2 2
using iTextSharp.text.pdf;
3
using MarkupToPDF.Common;
3 4
using MarkupToPDF.Controls.Common;
4 5
using System;
5 6
using System.Collections.Generic;
......
13 14
    public partial class DrawSet_Text
14 15
    {
15 16
        /// <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 17
        /// draw string
71 18
        /// </summary>
72 19
        /// <param name="sp"></param>
......
88 35
                                      FontFamily fontFamilly, FontStyle fontstyle, FontWeight fontweight, TextDecorationCollection isUnderline,
89 36
                                      string text, System.Drawing.SizeF size, double opac, double Angle)
90 37
        {
38

  
39
            if(string.IsNullOrWhiteSpace(text ))
40
            {
41
                text = "";
42
            }
43

  
91 44
            BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A);
92 45
            contentByte.SaveState();
93 46

  
......
150 103
                for (int i = 1; i <= transformed.Count; ++i) contentByte.LineTo(transformed[i%transformed.Count].X, transformed[i%transformed.Count].Y);
151 104
                DrawSet_Text.PaintFill(contentByte, PaintStyle, bs);
152 105
            }
153

  
154
            iTextSharp.text.Font itextFont = DrawSet_Text.CreateFont(fontFamilly, fontstyle, fontweight, isUnderline, calRect, text);
106
            
107
            iTextSharp.text.Font itextFont = CommonFont.CreateFont(fontFamilly, fontstyle, fontweight, isUnderline, calRect, text);
155 108

  
156 109
            contentByte.SetColorStroke(bs);
157 110
            contentByte.SetColorFill(bs);
......
168 121
                };
169 122
                mat.TransformPoints(origin);
170 123

  
171
                ColumnText.ShowTextAligned(contentByte, Element.ALIGN_CENTER, new Phrase(new Chunk(text, itextFont)), origin[0].X, origin[0].Y, (float)-Angle);
124
                UTF8Encoding utf8 = new UTF8Encoding();
125
                Byte[] utf8String = utf8.GetBytes(text);
126
                
127
                ColumnText.ShowTextAligned(contentByte, Element.ALIGN_CENTER, new Phrase(new Chunk(utf8.GetString(utf8String), itextFont)), origin[0].X, origin[0].Y, (float)-Angle);
172 128
            }
173 129
            /// multi line text
174 130
            else
......
246 202
            mat.TransformPoints(border);   /// transform if given angle is not 0
247 203
            var transformed = border.Select(param => new Point(param.X, param.Y)).ToList();
248 204
            /// up to here
249

  
205
            
250 206
            DrawSet_Text.DrawString(sp, ep, lineSize, contentByte, color, PaintStyle, FontSize, fontFamilly, fontstyle, fontweight, isUnderline, text, size, opac, Angle);
251 207
            DrawLeaderLine(ptHead, ptMid, bIsFixed, transformed, lineSize, contentByte, color, opac);
252 208
        }
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/DrawSet_Image.cs
7 7
using System.Xml;
8 8
using iTextSharp.text;
9 9
using iTextSharp.text.pdf;
10
using KCOMDataModel.Common;
10 11
using KCOMDataModel.DataModel;
11 12
using MarkupToPDF.Common;
12 13
using MarkupToPDF.Controls.Common;
......
16 17
{
17 18
    public class DrawSet_Image : BaseMethod
18 19
    {
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
        public static void DrawSign_debug(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
        {
21 22
            contentByte.SaveState();
22 23
            byte[] imageBytes = null;
......
54 55

  
55 56
            contentByte.RestoreState();
56 57
        }
57
        
58

  
59
        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)
60
        {
61
            contentByte.SaveState();
62
            byte[] imageBytes = null;
63

  
64
            using (CIEntities cIEntity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(projectNo).ToString()))
65
            {
66
               var  sIGNINFO = from sin in cIEntity.SIGN_INFO
67
                                 where sin.MEMBER_USER_ID == UserID
68
                                 select sin;
69

  
70
                if(sIGNINFO.Count() > 0)
71
                {
72
                    imageBytes = Convert.FromBase64String(sIGNINFO.First<SIGN_INFO>().SIGN_STR);
73
                }
74
            }
75

  
76
            if (imageBytes == null)
77
            {
78
                using (DataController dataController = new DataController())
79
                {
80
                    imageBytes = dataController.GetUserSignData(projectNo, UserID);
81
                }
82
            }
83

  
84
            using (System.IO.MemoryStream ms = new System.IO.MemoryStream(imageBytes))
85
            {
86
                var midP = MathSet.getMiddlePoint(startPoint, endPoint);
87
                List<System.Windows.Point> tempPoint = new List<System.Windows.Point>();
88
                foreach (var item in pointSet)
89
                {
90
                    tempPoint.Add(MathSet.RotateAbout(midP, item, Angle));
91
                }
92

  
93
                var Rect = GetPointsToRectX(tempPoint);
94

  
95
                Image img = Image.GetInstance(ms);
96
                img.ScaleAbsolute(Rect.Width, Rect.Height);
97

  
98
                img.SetAbsolutePosition(Rect.Left + ((Rect.Width - img.ScaledWidth) / 2), Rect.Bottom + ((Rect.Height - img.ScaledHeight) / 2));
99
                var x = Rect.Left + ((Rect.Width - img.ScaledWidth) / 2);
100
                var y = Rect.Bottom + ((Rect.Height - img.ScaledHeight) / 2);
101
                midP = MathSet.getMiddlePoint(new System.Windows.Point(x, y), new System.Windows.Point(x + img.ScaledWidth, y + img.ScaledHeight));
102
                System.Drawing.Drawing2D.Matrix mat2 = new System.Drawing.Drawing2D.Matrix();
103
                mat2.RotateAt((float)Angle * -1, new System.Drawing.PointF((float)midP.X, (float)midP.Y));
104
                contentByte.Transform(mat2);
105
                PdfGState gs1 = new PdfGState();
106
                gs1.FillOpacity = (float)opac;
107
                contentByte.SetGState(gs1);
108
                contentByte.AddImage(img);
109
            }
110

  
111
            contentByte.RestoreState();
112
        }
113

  
58 114
        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 115
        {
60 116
            contentByte.SaveState();
......
71 127
            image.ScaleAbsolute(Rect3.Width, Rect3.Height);
72 128
            image.SetAbsolutePosition((float)startPoint.X, (float)startPoint.Y - Rect3.Height);
73 129

  
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);
130
            //System.Drawing.Drawing2D.Matrix mat2 = new System.Drawing.Drawing2D.Matrix();
131
            //mat2.RotateAt((float)Angle * -1, new System.Drawing.PointF((float)startPoint.X, (float)startPoint.Y));
132
            //contentByte.Transform(mat2);
133

  
134
            iTextSharp.awt.geom.AffineTransform affineTransform = new iTextSharp.awt.geom.AffineTransform();
135
            affineTransform.Rotate(Angle * -1,startPoint.X,startPoint.Y);
136
            contentByte.Transform(affineTransform);
137

  
77 138
            PdfGState gs1 = new PdfGState();
78 139
            gs1.FillOpacity = (float)opac;
79 140
            contentByte.SetGState(gs1);
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/DrawSet_Symbol.cs
1 1
using iTextSharp.text;
2 2
using iTextSharp.text.pdf;
3
using MarkupToPDF.Common;
3 4
using MarkupToPDF.Controls.Common;
4 5
using System;
5 6
using System.Collections.Generic;
......
13 14

  
14 15
namespace MarkupToPDF.Controls_PDF
15 16
{
16
    public class HoneyPDFLib_DrawSet_Symbol : BaseMethod
17
    public class PDFLib_DrawSet_Symbol : BaseMethod
17 18
    {
18
        public static void DrawApproval(Point sp, Point ep, List<Point> pointSet, PdfContentByte contentByte, SolidColorBrush color, double Angle, double opac, string ApprovedImgPath)
19
        public static void DrawApprovalImagePath(Point sp, Point ep, List<Point> pointSet, PdfContentByte contentByte, SolidColorBrush color, double Angle, double opac, string ApprovedImgPath)
19 20
        {
20 21
            contentByte.SaveState();
21 22
            BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A);
......
41 42
            contentByte.RestoreState();
42 43
        }
43 44

  
45
        public static void DrawApprovalXamlData(Point sp, Point ep, List<Point> pointSet, PdfContentByte contentByte, SolidColorBrush color, double Angle, double opac, string xamlData)
46
        {
47
            contentByte.SaveState();
48
            BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A);
49
            var midP = MathSet.getMiddlePoint(sp, ep);
50

  
51
            List<System.Windows.Point> tempPoint = new List<System.Windows.Point>();
52

  
53
            foreach (var item in pointSet)
54
            {
55
                tempPoint.Add(MathSet.RotateAbout(midP, item, Angle));
56
            }
57

  
58
            var Rect = GetPointsToRectX(tempPoint);
59

  
60
            XAMLtoPNG.XamlToPngConverter xamlToPngConverter = new XAMLtoPNG.XamlToPngConverter();
61
            using (var xamlDataStream = StreamHelper.GenerateStreamFromString(xamlData))
62
            {
63
                using (MemoryStream streamOut = new MemoryStream())
64
                {
65
                    
66
                    xamlToPngConverter.Convert(xamlDataStream, 205, 89, 96, 96, XAMLtoPNG.ScaleTO.OriginalSize, streamOut);
67
             
68
                    if (streamOut.Length > 0)
69
                    {
70
                        Image img = Image.GetInstance(streamOut.ReadFully());
71

  
72
                        #region 이전코드 
73
                        //img.ScaleToFit(Rect3.Width, Rect3.Height);
74

  
75
                        //img.SetAbsolutePosition(Rect3.Left + ((Rect3.Width - img.ScaledWidth) / (float)5), Rect3.Bottom + ((Rect3.Height - img.ScaledHeight) / (float)5));
76

  
77
                        //var xxxx = Rect3.Left + ((Rect3.Width - img.ScaledWidth) / 2);
78
                        //var x = Rect3.Left + ((Rect3.Width - img.ScaledWidth) / 2);
79
                        //var y = Rect3.Bottom + ((Rect3.Height - img.ScaledHeight) / 2);
80
                        //midP = MathSet.getMiddlePoint(new Point(x, y), new Point(x + img.ScaledWidth, y + img.ScaledHeight));
81
                        //System.Drawing.Drawing2D.Matrix mat2 = new System.Drawing.Drawing2D.Matrix();
82
                        //mat2.RotateAt((float)Angle * -1, new System.Drawing.PointF((float)midP.X, (float)midP.Y));
83
                        //contentByte.Transform(mat2);
84

  
85
                        #endregion
86

  
87
                        img.ScaleAbsolute(Rect.Width, Rect.Height);
88
                        img.SetAbsolutePosition((float)sp.X, (float)sp.Y - Rect.Height);
89

  
90
                        iTextSharp.awt.geom.AffineTransform affineTransform = new iTextSharp.awt.geom.AffineTransform();
91
                        affineTransform.Rotate(Angle * -1, sp.X, sp.Y);
92
                        contentByte.Transform(affineTransform);
93

  
94
                        contentByte.AddImage(img);
95
                        contentByte.RestoreState();
96
                    }
97
                }
98
            }
99
        }
100

  
44 101
        public static void DrawCheckMark(Point sp, Point ep, List<Point> pointSet, PdfContentByte contentByte, SolidColorBrush color, double Angle, double opac, string ImgPath)
45 102
        {
46 103
            contentByte.SaveState();
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/HoneyPDFLib_DrawSet_Text.cs
1
using iTextSharp.text.pdf;
2
using MarkupToPDF.Controls.Common;
3
using System;
4
using System.Collections.Generic;
5
using System.Linq;
6
using System.Text;
7
using System.Windows;
8
using System.Windows.Media;
9
using iTextSharp.text;
10

  
11
namespace MarkupToPDF.Controls_PDF
12
{
13
    public partial class HoneyPDFLib_DrawSet_Text : BaseMethod
14
    {
15
        public static Size ComputeScaleFactor(Size availableSize, Size contentSize)
16
        {
17
            double scaleX = 1.0;
18
            double scaleY = 1.0;
19

  
20
            bool isConstrainedWidth = !double.IsPositiveInfinity(availableSize.Width);
21
            bool isConstrainedHeight = !double.IsPositiveInfinity(availableSize.Height);
22
            Stretch stretch = Stretch.Uniform; //현재 상태에서는 무조건 uniform으로 처리한다
23

  
24
            // Don't scale if we shouldn't stretch or the scaleX and scaleY are both infinity.
25
            if ((stretch != Stretch.None) && (isConstrainedWidth || isConstrainedHeight))
26
            {
27
                // Compute the individual scaleX and scaleY scale factors
28
                scaleX = contentSize.Width == 0 ? 0.0 : (availableSize.Width / contentSize.Width);
29
                scaleY = contentSize.Height == 0 ? 0.0 : (availableSize.Height / contentSize.Height);
30

  
31
                // Make the scale factors uniform by setting them both equal to
32
                // the larger or smaller (depending on infinite lengths and the
33
                // Stretch value)
34
                if (!isConstrainedWidth)
35
                {
36
                    scaleX = scaleY;
37
                }
38
                else if (!isConstrainedHeight)
39
                {
40
                    scaleY = scaleX;
41
                }
42
                else
43
                {
44
                    // (isConstrainedWidth && isConstrainedHeight)
45
                    switch (stretch)
46
                    {
47
                        case Stretch.Uniform:
48
                            // Use the smaller factor for both
49
                            scaleX = scaleY = Math.Min(scaleX, scaleY);
50
                            break;
51
                        case Stretch.UniformToFill:
52
                            // Use the larger factor for both
53
                            scaleX = scaleY = Math.Max(scaleX, scaleY);
54
                            break;
55
                        case Stretch.Fill:
56
                        default:
57
                            break;
58
                    }
59
                }
60
            }
61

  
62
            return new Size(scaleX, scaleY);
63
        }
64

  
65
        public static void DrawDate(Point sp, Point ep, List<Point> pointSet, PdfContentByte contentByte, System.Windows.Media.SolidColorBrush color, string text, double angle, double opac)
66
        {
67

  
68

  
69
            bool isError = false;
70
            BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A);
71
            contentByte.SaveState();
72

  
73

  
74
            #region 폰트 지정
75
            //string ARIALUNI_TFF = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "Arial Unicode MS.TTF");
76
            
77
            //인구 테스트
78
            string ARIALUNI_TFF = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "Arial Unicode MS.TTF");
79
            //string ARIALUNI_TFF = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "Arial");
80

  
81
            BaseFont bf = BaseFont.CreateFont(ARIALUNI_TFF, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
82

  
83
            #endregion
84

  
85
            #region 박스 영역 계산
86
            //var rect = GetPointsToRectX(pointSet);
87
            //var rectM = getRectMiddlePoint(new Rect(sp, ep)); 
88
            var midP = MathSet.getMiddlePoint(sp, ep);
89
            List<System.Windows.Point> tempPoint = new List<System.Windows.Point>();
90
            foreach (var item in pointSet)
91
            {
92
                tempPoint.Add(MathSet.RotateAbout(midP, item, angle));
93
            }
94
            var rect = GetPointsToRectX(tempPoint);
95

  
96
            #endregion
97
            Size size = new Size();
98
            //var fontSize = rect.Height;
99
            //var Ros = new System.Windows.Controls.TextBlock() { Text = text, FontFamily = new FontFamily("Arial") };
100

  
101
            UIElement Ros = new UIElement();
102
            Ros.Arrange(new Rect(rect.Left, rect.Top, rect.Width, rect.Height));
103

  
104
            Size scale = ComputeScaleFactor(new Size(rect.Width, rect.Height), Ros.RenderSize);
105

  
106
            size.Width = scale.Width * Ros.RenderSize.Width;
107
            size.Height = scale.Height * Ros.RenderSize.Height;
108
            Ros.Measure(size);
109
            var fontSize = (int)size.Height;
110
            float width = bf.GetWidthPoint(text, fontSize);
111
            float height = bf.GetAscentPoint(text, fontSize)
112
               - bf.GetDescentPoint(text, fontSize);
113

  
114

  
115
            PdfTemplate template = contentByte.CreateTemplate(width, height + 1);
116
            template.BeginText();
117

  
118
            try
119
            {
120
                template.SetFontAndSize(bf, fontSize);
121
                if (bf.GetDescentPoint(text, fontSize) < 0)
122
                {
123
                    template.SetTextMatrix(0, 1);
124
                }
125
                else
126
                {
127
                    template.SetTextMatrix(0, bf.GetDescentPoint(text, fontSize));
128
                }
129
                template.SetColorFill(bs);
130
                template.SetColorStroke(bs);
131
                template.ShowText(text);
132

  
133
                Image img = Image.GetInstance(template);
134
                //img.ScalePercent((float)65, (float)65); //실 면적 대비 계산식 , 구해진 Fontsize로 Fit하면 안됨.
135
                img.ScaleToFit((float)size.Width, (float)size.Height);
136

  
137
                img.SetAbsolutePosition(rect.Left + ((rect.Width - img.ScaledWidth) / 2), rect.Bottom + ((rect.Height - img.ScaledHeight) / 2));
138
                var x = rect.Left + ((rect.Width - img.ScaledWidth) / 2);
139
                var y = rect.Bottom + ((rect.Height - img.ScaledHeight) / 2);
140
                midP = MathSet.getMiddlePoint(new Point(x, y), new Point(x + img.ScaledWidth, y + img.ScaledHeight));
141
                System.Drawing.Drawing2D.Matrix mat2 = new System.Drawing.Drawing2D.Matrix();
142
                mat2.RotateAt((float)angle * -1, new System.Drawing.PointF((float)midP.X, (float)midP.Y));
143
                contentByte.Transform(mat2);
144
                PdfGState gs1 = new PdfGState();
145
                gs1.FillOpacity = (float)opac;
146
                contentByte.SetGState(gs1);
147
                contentByte.AddImage(img);
148
            }
149
            catch (Exception ex)
150
            {
151
                isError = true;
152
                contentByte.RestoreState();
153
                template.EndText();
154
            }
155
            if (!isError)
156
            {
157
                template.EndText();
158
                contentByte.RestoreState();
159
            }
160
        }
161
    }
162
}
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/PDFLib_DrawSet_Text.cs
1
using iTextSharp.text.pdf;
2
using MarkupToPDF.Controls.Common;
3
using System;
4
using System.Collections.Generic;
5
using System.Linq;
6
using System.Text;
7
using System.Windows;
8
using System.Windows.Media;
9
using iTextSharp.text;
10
using MarkupToPDF.Common;
11
using Markus.Fonts;
12

  
13
namespace MarkupToPDF.Controls_PDF
14
{
15
    public partial class PDFLib_DrawSet_Text : BaseMethod
16
    {
17
        public static Size ComputeScaleFactor(Size availableSize, Size contentSize)
18
        {
19
            double scaleX = 1.0;
20
            double scaleY = 1.0;
21

  
22
            bool isConstrainedWidth = !double.IsPositiveInfinity(availableSize.Width);
23
            bool isConstrainedHeight = !double.IsPositiveInfinity(availableSize.Height);
24
            Stretch stretch = Stretch.Uniform; //현재 상태에서는 무조건 uniform으로 처리한다
25

  
26
            // Don't scale if we shouldn't stretch or the scaleX and scaleY are both infinity.
... 이 차이점은 표시할 수 있는 최대 줄수를 초과해서 이 차이점은 잘렸습니다.

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)