프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / FinalService / KCOM_FinalService / MarkupToPDF / MarkupToPDF.cs @ 68e3cd94

이력 | 보기 | 이력해설 | 다운로드 (85.2 KB)

1
using IFinalPDF;
2
using iTextSharp.text.pdf;
3
using KCOMDataModel.Common;
4
using KCOMDataModel.DataModel;
5
using MarkupToPDF.Controls.Common;
6
using MarkupToPDF.Serialize.Core;
7
using MarkupToPDF.Serialize.S_Control;
8
using Markus.Fonts;
9
using System;
10
using System.Collections.Generic;
11
using System.Configuration;
12
using System.IO;
13
using System.Linq;
14
using System.Net;
15
using System.Runtime.InteropServices;
16
using System.Text;
17
using System.Web;
18
using System.Windows;
19
using System.Windows.Media;
20

    
21
namespace MarkupToPDF
22
{
23
    public class MarkupToPDF : IDisposable
24
    {
25

    
26
        #region 초기 데이터
27
        private static iTextSharp.text.Rectangle mediaBox;
28
        private FileInfo PdfFilePath = null;
29
        private FileInfo FinalPDFPath = null;
30
        private string _FinalPDFStorgeLocal = null;
31
        private string _FinalPDFStorgeRemote = null;
32
        private string OriginFileName = null;
33
        public FINAL_PDF FinalItem;
34
        public DOCINFO DocInfoItem = null;
35
        public List<DOCPAGE> DocPageItem = null;
36
        public MARKUP_INFO MarkupInfoItem = null;
37
        public List<MARKUP_DATA> MarkupDataSet = null;
38
        //private string _PrintPDFStorgeLocal = null;
39
        //private string _PrintPDFStorgeRemote = null;
40
        public event EventHandler<MakeFinalErrorArgs> FinalMakeError;
41
        public event EventHandler<EndFinalEventArgs> EndFinal;
42
        public event EventHandler<StatusChangedEventArgs> StatusChanged;
43

    
44
        private iTextSharp.text.Rectangle pdfSize { get; set; }
45
        private double pageW = 0;
46
        private double pageH = 0;
47

    
48
        //private const double zoomLevel = 3.0;
49
        private const double zoomLevel = 1.0; // 지금은 3배수로 곱하지 않고 있음
50
        #endregion
51

    
52
        #region 메서드        
53
        public static bool IsLocalIPAddress(string host)
54
        {
55
            try
56
            {
57
                IPAddress[] hostIPs = Dns.GetHostAddresses(host);
58
                IPAddress[] localIPs = Dns.GetHostAddresses(Dns.GetHostName());
59

    
60
                foreach (IPAddress hostIP in hostIPs)
61
                {
62
                    if (IPAddress.IsLoopback(hostIP)) return true;
63

    
64
                    foreach (IPAddress localIP in localIPs)
65
                    {
66
                        if (hostIP.Equals(localIP)) return true;
67
                    }
68
                }
69
            }
70
            catch { }
71
            return false;
72
        }
73

    
74
        private void SetNotice(string finalID, string message)
75
        {
76
            if (FinalMakeError != null)
77
            {
78
                FinalMakeError(this, new MakeFinalErrorArgs { FinalID = finalID, Message = message });
79
            }
80
        }
81

    
82
        private string GetFileName(string hrefLink)
83
        {
84
            try
85
            {
86
                if (hrefLink.Contains("vpcs_doclib"))
87
                {
88
                    return System.IO.Path.GetFileName(hrefLink.Replace("/", "\\"));
89
                }
90
                else
91
                {
92
                    Uri fileurl = new Uri(hrefLink);
93
                    int index = hrefLink.IndexOf("?");
94
                    string filename = HttpUtility.ParseQueryString(fileurl.Query).Get("fileName");
95
                    return filename;
96
                }
97
            }
98
            catch (Exception ex)
99
            {
100
                throw ex;
101
            }
102
        }
103

    
104
        public Point GetPdfPointSystem(Point point)
105
        {
106
            /// 주어진 좌표를 pdf의 (Left, Top - Bottom(?)) 좌표에 맞추어 변환한다.
107
            /// Rotation 90 일 경우 pdfsize box 와 media box 가 달라 다른 계산식 적용
108
            if (pdfSize.Rotation == 90)
109
            {
110
                return new Point(pdfSize.Left + (float)(point.X / scaleWidth), pdfSize.Top - (float)(point.Y / scaleHeight) - pdfSize.Bottom);
111
            }
112
            else
113
            {
114
                return new Point(pdfSize.Left + (float)(point.X / scaleWidth), pdfSize.Height - (float)(point.Y / scaleHeight) + pdfSize.Bottom);
115
            }  
116
        }
117

    
118
        public double GetPdfSize(double size)
119
        {
120
            return (size / scaleWidth);
121
        }
122

    
123
        public List<Point> GetPdfPointSystem(List<Point> point)
124
        {
125
            List<Point> dummy = new List<Point>();
126
            foreach (var item in point)
127
            {
128
                dummy.Add(GetPdfPointSystem(item));
129
            }
130
            return dummy;
131
        }
132

    
133
        public double returnAngle(Point start, Point end)
134
        {
135
            double angle = MathSet.getAngle(start.X, start.Y, end.X, end.Y);
136
            //angle *= -1;
137

    
138
            angle += 90;
139
            //if (angle < 0)
140
            //{
141
            //    angle = angle + 360;
142
            //}
143
            return angle;
144
        }
145

    
146
        #endregion
147

    
148
        public bool AddStamp(string stampData)
149
        {
150
            bool result = false;
151

    
152
            try
153
            {
154
                using (KCOMEntities _entity = new KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString()))
155
                {
156
                    var stamp = _entity.PROPERTIES.Where(x => x.TYPE == "STAMP");
157

    
158
                    if(stamp.Count() > 0)
159
                    {
160
                        var xamldata = Serialize.Core.JsonSerializerHelper.CompressStamp(stampData);
161

    
162
                        stamp.First().VALUE = xamldata;
163
                        _entity.SaveChanges();
164
                        result = true;
165
                    }
166
                }
167
            }
168
            catch (Exception)
169
            {
170

    
171
                throw;
172
            }
173

    
174
            return result;
175

    
176
        }
177

    
178
        /// <summary>
179
        /// local에서 final 생성하는 경우 이 함수로 추가 후 실행
180
        /// </summary>
181
        /// <param name="finalpdf"></param>
182
        /// <returns></returns>
183
        public AddFinalPDFResult AddFinalPDF(string ProjectNo,string DocumentID,string UserID)
184
        {
185
            //var list = Markus.Fonts.FontHelper.GetFontStream("Arial Unicode MS");
186
            //System.Diagnostics.Debug.WriteLine(list);
187

    
188
            AddFinalPDFResult result = new AddFinalPDFResult { Success = false };
189

    
190
            try
191
            {
192
                FINAL_PDF addItem = new FINAL_PDF{
193
                    ID = CommonLib.Guid.shortGuid(),
194
                    PROJECT_NO = ProjectNo,
195
                    DOCUMENT_ID = DocumentID,
196
                    CREATE_USER_ID = UserID,
197
                    CREATE_DATETIME = DateTime.Now,
198
                    STATUS = 4
199
                };
200

    
201
                using (CIEntities _entity = new CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
202
                {
203
                    var docitems = _entity.DOCINFO.Where(x => x.PROJECT_NO == ProjectNo && x.DOCUMENT_ID == DocumentID);
204

    
205
                    if(docitems.Count() > 0)
206
                    {
207
                        addItem.DOCINFO_ID = docitems.First().ID;
208
                        result.Success = true;
209
                    }
210
                    else
211
                    {
212
                        result.Exception = "docInfo Not Found.";
213
                        result.Success = false;
214
                    }
215

    
216
                    var markupInfoItems = _entity.MARKUP_INFO.Where(x =>x.DOCINFO_ID == addItem.DOCINFO_ID);
217

    
218
                    if (markupInfoItems.Count() > 0)
219
                    {
220
                        addItem.MARKUPINFO_ID = markupInfoItems.First().ID;
221
                        result.Success = true;
222
                    }
223
                    else
224
                    {
225
                        result.Exception = "Markup Info Not Found.";
226
                        result.Success = false;
227
                    }
228
                }
229

    
230
                if (result.Success)
231
                {
232
                    using (KCOMEntities _entity = new KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString()))
233
                    {
234
                        var finalList = _entity.FINAL_PDF.Where(final => final.ID == addItem.ID);
235

    
236
                        /// Insrt and Update
237
                        if (finalList.Count() == 0)
238
                        {
239
                            _entity.FINAL_PDF.AddObject(addItem);
240
                            _entity.SaveChanges();
241

    
242
                            result.FinalPDF = addItem;
243
                            result.Success = true;
244
                        }
245
                    }
246
                }
247
            }
248
            catch (Exception ex)
249
            {
250
                System.Diagnostics.Debug.WriteLine(ex);
251
                result.Success = false;
252
            }
253

    
254
            return result;
255
        }
256

    
257
        #region 생성자 & 소멸자
258
        public void MakeFinalPDF(object _FinalPDF)
259
        {
260
            DOCUMENT_ITEM documentItem;
261
            FINAL_PDF FinalPDF = (FINAL_PDF)_FinalPDF;
262
            FinalItem = FinalPDF;
263

    
264

    
265
            string PdfFilePathRoot = null;
266
            string TestFile = System.IO.Path.GetTempFileName();
267

    
268
            #region 문서 경로를 가져오는 것과 Status를 Create (1단계) 로 수정
269
            try
270
            {
271
                using (KCOMEntities _entity = new KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString()))
272
                {
273
                    var _properties = _entity.PROPERTIES.Where(pro => pro.PROPERTY == FinalPDF.PROJECT_NO);
274

    
275
                    if (_properties.Count() > 0)
276
                    {
277
                        if (_properties.Where(t => t.TYPE == PropertiesType.Const_TileSorcePath).Count() == 0)
278
                        {
279
                            SetNotice(FinalPDF.ID, $"Project {FinalPDF.PROJECT_NO} : TileSourcePath Not Found.");
280
                            return;
281
                        }
282
                        else
283
                        { 
284
                            PdfFilePathRoot = _properties.Where(t => t.TYPE == PropertiesType.Const_TileSorcePath).First().VALUE;
285
                        }
286

    
287
                        if (_properties.Where(t => t.TYPE == PropertiesType.Const_FinalPDFStorgeLocal).Count() == 0)
288
                        {
289
                            SetNotice(FinalPDF.ID, $"Project {FinalPDF.PROJECT_NO} : FinalPDFStorgeLocal Not Found.");
290
                            return;
291
                        }
292
                        else
293
                        {
294
                            _FinalPDFStorgeLocal = _properties.Where(t => t.TYPE == PropertiesType.Const_FinalPDFStorgeLocal).First().VALUE;
295
                        }
296

    
297

    
298
                        if (_properties.Where(t => t.TYPE == PropertiesType.Const_FinalPDFStorgeRemote).Count() == 0)
299
                        {
300
                            SetNotice(FinalPDF.ID, $"Project {FinalPDF.PROJECT_NO} : FinalPDFStorgeRemote Not Found.");
301
                            return;
302
                        }
303
                        else
304
                        {
305
                            _FinalPDFStorgeRemote = _properties.Where(t => t.TYPE == PropertiesType.Const_FinalPDFStorgeRemote).First().VALUE;
306
                        }
307
                    }
308
                    else
309
                    {
310
                        SetNotice(FinalPDF.ID, $"Project {FinalPDF.PROJECT_NO} : Final PDF Properties Not Found.");
311
                        return;
312
                    }
313

    
314
                    var finalList = _entity.FINAL_PDF.Where(final => final.ID == FinalPDF.ID);
315

    
316
                    if (finalList.Count() > 0)
317
                    {
318
                        finalList.FirstOrDefault().START_DATETIME = DateTime.Now;
319
                        finalList.FirstOrDefault().STATUS = (int)FinalStatus.Create;
320
                        _entity.SaveChanges();
321
                    }
322

    
323
                }
324
            }
325
            catch (Exception ex)
326
            {
327
                SetNotice(FinalPDF.ID, "프로퍼티 에러: " + ex.ToString());
328
                return;
329
            }
330
            #endregion
331

    
332
            #region 문서 복사
333
            try
334
            {
335
                using (CIEntities _entity = new CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(FinalPDF.PROJECT_NO).ToString()))
336
                {
337
                    var _DOCINFO = _entity.DOCINFO.Where(doc => doc.ID == FinalPDF.DOCINFO_ID);
338

    
339
                    if (_DOCINFO.Count() > 0)
340
                    {
341
                        DocInfoItem = _DOCINFO.FirstOrDefault();
342
                        DocPageItem = DocInfoItem.DOCPAGE.ToList();
343

    
344
                        PdfFilePathRoot = PdfFilePathRoot + @"\" + FinalPDF.PROJECT_NO + "_Tile" + @"\"
345
                                         + (FinalPDF.DOCUMENT_ID.All(char.IsDigit) ? (System.Convert.ToInt64(FinalPDF.DOCUMENT_ID) / 100).ToString() : FinalPDF.DOCUMENT_ID.Substring(0, 5))
346
                                         + @"\" + FinalPDF.DOCUMENT_ID + @"\";
347

    
348
                        MarkupInfoItem = DocInfoItem.MARKUP_INFO.Where(data => data.CONSOLIDATE == 1 && data.AVOID_CONSOLIDATE == 0 && data.PART_CONSOLIDATE == 0).FirstOrDefault();
349

    
350
                        if (MarkupInfoItem == null)
351
                        {
352
                            throw new Exception("콘솔리데잇이 작업 요청 후에 수정 / 삭제 되었습니다");
353
                        }
354
                        else
355
                        {
356
                            if (MarkupInfoItem.MARKUP_INFO_VERSION.Count > 0)
357
                            {
358
                                MarkupDataSet = MarkupInfoItem.MARKUP_INFO_VERSION.OrderBy(d => d.CREATE_DATE).LastOrDefault().MARKUP_DATA.ToList().OrderBy(d => d.PAGENUMBER).ToList();
359
                            }
360
                            else
361
                            {
362
                                throw new Exception("MARKUP_INFO_VERSION 이 존재 하지 않습니다");
363
                            }
364
                        }
365

    
366
                        documentItem = _entity.DOCUMENT_ITEM.Where(data => data.DOCUMENT_ID == DocInfoItem.DOCUMENT_ID && data.PROJECT_NO == FinalPDF.PROJECT_NO).FirstOrDefault();
367
                        if (documentItem == null)
368
                        {
369
                            throw new Exception("DocInfo와 DocumentItem의 documentItemID가 같지 않습니다. 데이터를 확인해주세요");
370
                        }
371

    
372
                        var _files = new DirectoryInfo(PdfFilePathRoot).GetFiles("*.pdf"); //해당 폴더에 파일을 
373

    
374
                        #region 파일 체크
375
                        if (_files.Count() == 1)
376
                        {
377
                            /// 문서 관리 시스템의 원본 PDF 파일과 비교 --> 삭제될 예정
378
                            //if (_files.First().Name.ToLower() == GetFileName(HttpUtility.UrlDecode(documentItem.ORIGINAL_FILE).ToLower()))
379
                            //{
380
                                OriginFileName = _files.First().Name;
381
                                PdfFilePath = _files.First().CopyTo(TestFile, true);
382
                                StatusChange($"Copy File  file Count = 1 : {PdfFilePath}", 0);
383
                            //}
384
                            //else
385
                            //{
386
                            //    throw new Exception("현재 폴더 내 파일명이 데이터베이스와 상이합니다.filename:" + _files.First().Name.ToLower() + ",url:" + HttpUtility.UrlDecode(documentItem.ORIGINAL_FILE).ToLower());
387
                            //}
388
                        }
389
                        else if (_files.Count() > 1)
390
                        {
391
                            var originalFile = _files.Where(data => data.Name == GetFileName(HttpUtility.UrlDecode(documentItem.ORIGINAL_FILE))).FirstOrDefault();
392

    
393
                            if (originalFile == null)
394
                            {
395
                                throw new Exception("해당 폴더에 복수로 PDF들 존재하고 document_Item의 문서는 존재하지 않습니다");
396
                            }
397
                            else
398
                            {
399
                                OriginFileName = originalFile.Name;
400
                                PdfFilePath = originalFile.CopyTo(TestFile, true);
401
                                StatusChange($"Copy File file Count  > 1 : {PdfFilePath}", 0);
402
                            }
403
                        }
404
                        else
405
                        {
406
                            throw new FileNotFoundException("PDF를 찾지 못하였습니다");
407
                        }
408
                        #endregion
409

    
410
                        #region 예외처리
411
                        if (PdfFilePath == null)
412
                        {
413
                            throw new Exception("작업에 필요한 PDF가 정상적으로 복사되지 않았거나 DB정보가 상이합니다");
414
                        }
415
                        if (!PdfFilePath.Exists)
416
                        {
417
                            throw new Exception("PDF원본이 존재하지 않습니다");
418
                        }
419
                        #endregion
420
                        
421
                    }
422
                    else
423
                    {
424
                        throw new Exception("일치하는 DocInfo가 없습니다");
425
                    }
426
                }
427
            }
428
            catch (Exception ex)
429
            {
430
                if (ex.Message == "사용 가능한" || ex.Message == "작업을 완료했습니다")
431
                {
432
                    SetNotice(FinalPDF.ID, "Desktop 내 힙메모리 부족으로 서비스 진행이 되지 않아 재시작 합니다");
433
                    System.Diagnostics.Process process = new System.Diagnostics.Process();
434
                    process.StartInfo.FileName = "cmd";
435
                    process.StartInfo.Arguments = "/c net stop \"FinalService\" & net start \"FinalService\"";
436
                    process.Start();
437
                }
438
                else
439
                {
440
                    SetNotice(FinalPDF.ID, "PDF를 Stamp 중 에러 : " + ex.Message);
441
                }
442
            }
443
            #endregion
444

    
445
            try
446
            {
447

    
448
                using (KCOMEntities _entity = new KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString()))
449
                {
450
                    var finalList = _entity.FINAL_PDF.Where(final => final.ID == FinalPDF.ID);
451

    
452
                    if (finalList.Count() > 0)
453
                    {
454
                        //TestFile = SetFlattingPDF(TestFile);
455
                        //StatusChange($"SetFlattingPDF : {TestFile}", 0);
456

    
457
                        SetStampInPDF(FinalItem, TestFile, MarkupInfoItem);
458

    
459
                        StatusChange($"SetStampInPDF : {TestFile}", 0);
460
                    }
461
                }
462
                if (EndFinal != null)
463
                {
464
                    EndFinal(this, new EndFinalEventArgs
465
                    {
466
                        FinalPDFRemotePath = _FinalPDFStorgeRemote + @"\" + FinalPDFPath.Name,
467
                        OriginPDFName = OriginFileName,
468
                        FinalPDFPath = FinalPDFPath.FullName,
469
                        Error = "",
470
                        Message = "",
471
                        FinalPDF = FinalPDF,
472
                    });
473
                }
474
            }
475
            catch (Exception ex)
476
            {
477
                SetNotice(FinalPDF.ID, "MarkFinalPDF Error : " + ex.Message);
478
            }
479
        }
480
        #endregion
481

    
482
        #region PDF
483
        public static float scaleWidth = 0;
484
        public static float scaleHeight = 0;
485

    
486
        private string SetFlattingPDF(string tempFileInfo)
487
        {
488
            if (File.Exists(tempFileInfo))
489
            {
490
                FileInfo TestFile = new FileInfo(System.IO.Path.GetTempFileName());
491

    
492
                PdfReader pdfReader = new PdfReader(tempFileInfo);
493

    
494
                for (int i = 1; i <= pdfReader.NumberOfPages; i++)
495
                {
496
                    var mediaBox = pdfReader.GetPageSize(i);
497
                    var cropbox = pdfReader.GetCropBox(i);
498

    
499
                    //using (CIEntities _entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString().ToString()))
500
                    //{
501
                    //    _entity.DOCPAGE.Where(d=>d.DOCINFO_ID == DocInfoItem.DOCPAGE)
502
                    //}
503
                    var currentPage = DocPageItem.Where(d => d.PAGE_NUMBER == i).FirstOrDefault();
504

    
505
                    //scaleWidth = float.Parse(currentPage.PAGE_WIDTH) / mediaBox.Width;
506
                    //scaleHeight = float.Parse(currentPage.PAGE_HEIGHT) / mediaBox.Height;
507
                    //scaleWidth = 2.0832634F;
508
                    //scaleHeight = 3.0F;
509

    
510
                    PdfRectangle rect = new PdfRectangle(cropbox, pdfReader.GetPageRotation(i));
511
                    //강인구 수정
512
                    //if (cropbox != null && (cropbox.Width < mediaBox.Width || cropbox.Height < cropbox.Height))
513
                    //if (cropbox != null && (cropbox.Width < mediaBox.Width || cropbox.Height < mediaBox.Height))
514
                    //{
515
                    //    var pageDict = pdfReader.GetPageN(i);
516
                    //    pageDict.Put(PdfName.MEDIABOX, rect);
517
                    //}
518
                }
519

    
520
                var memStream = new MemoryStream();
521
                var stamper = new PdfStamper(pdfReader, memStream)
522
                {
523
                    FormFlattening = true,                     
524
                    //FreeTextFlattening = true,
525
                    //AnnotationFlattening = true,                     
526
                };
527
                
528
                stamper.Close();
529
                pdfReader.Close();
530
                var array = memStream.ToArray();
531
                File.Delete(tempFileInfo);
532
                File.WriteAllBytes(TestFile.FullName, array);
533

    
534
                return TestFile.FullName;
535
            }
536
            else
537
            {
538
                return tempFileInfo;
539
            }
540
        }
541

    
542
        public void flattenPdfFile(string src, ref string dest)
543
        {
544
            PdfReader reader = new PdfReader(src);
545
            var memStream = new MemoryStream();
546
            var stamper = new PdfStamper(reader, memStream)
547
            {
548
                FormFlattening = true,
549
                FreeTextFlattening = true,
550
                AnnotationFlattening = true,
551
            };
552

    
553
            stamper.Close();
554
            var array = memStream.ToArray();
555
            File.WriteAllBytes(dest, array);
556
        }
557

    
558
        public void StatusChange(string message,int CurrentPage)
559
        {
560
            if(StatusChanged != null)
561
            {
562
                var sb = new StringBuilder();
563
                sb.AppendLine(message);
564

    
565
                StatusChanged(null, new StatusChangedEventArgs { CurrentPage = CurrentPage, Message = sb.ToString() });
566
            }
567
        }
568

    
569
        public bool SetStampInPDF(FINAL_PDF finaldata, string testFile, MARKUP_INFO markupInfo)
570
        {
571
            try
572
            {
573
        
574
                FileInfo tempFileInfo = new FileInfo(testFile);
575

    
576
                if (!Directory.Exists(_FinalPDFStorgeLocal))
577
                {
578
                    Directory.CreateDirectory(_FinalPDFStorgeLocal);
579
                }
580
                string pdfFilePath = Path.Combine(_FinalPDFStorgeLocal, tempFileInfo.Name);
581
          
582

    
583
                using (KCOMEntities _entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
584
                {
585
                    FINAL_PDF pdfLink = _entity.FINAL_PDF.Where(data => data.ID == finaldata.ID).FirstOrDefault();
586

    
587
                    #region 코멘트 적용 + 커버시트
588
                    using (Stream pdfStream = new FileInfo(testFile).Open(FileMode.Open, FileAccess.ReadWrite)) //
589
                    {
590
                        StatusChange("comment Cover",0);
591
                        
592
                        PdfReader pdfReader = new PdfReader(pdfStream);
593
                        //List<Dictionary<string, object>> lstoutlineTop = new List<Dictionary<string, object>>();
594
                        Dictionary<string, object> bookmark;
595
                        List<Dictionary<string, object>> outlines;
596

    
597
                        outlines = new List<Dictionary<string, object>>();
598
                        List<Dictionary<string, object>> root = new List<Dictionary<string, object>>();
599

    
600
                        var dic = new Dictionary<string, object>();
601

    
602
                        foreach (var data in MarkupDataSet)
603
                        {
604
                            StatusChange("MarkupDataSet", 0);
605

    
606
                            string userid = data.MARKUP_INFO_VERSION.MARKUP_INFO.USER_ID;
607

    
608
                            string username = "";
609
                            string userdept = "";
610

    
611
                            using (CIEntities cIEntities = new CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(finaldata.PROJECT_NO).ToString()))
612
                            {
613
                                var memberlist = KCOMDataModel.Common.ObjectQuery.GetMemberQuery(cIEntities, userid);
614

    
615
                                if(memberlist.Count() > 0)
616
                                {
617
                                    username = memberlist.First().NAME;
618
                                    userdept = memberlist.First().DEPARTMENT;
619
                                }
620
                            }
621

    
622
                            bookmark = new Dictionary<string, object>();
623
                            bookmark.Add("Title", string.Format("User:{0}[{1}] Commented Page : {2}", username, userdept, data.PAGENUMBER));
624
                            bookmark.Add("Page", data.PAGENUMBER + " Fit");
625
                            bookmark.Add("Action", "GoTo");
626
                            bookmark.Add("Kids", outlines);
627
                            root.Add(bookmark);
628
                        }
629

    
630

    
631
                        using (PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(pdfFilePath, FileMode.Create)))
632
                        {
633
                            AcroFields pdfFormFields = pdfStamper.AcroFields;
634

    
635
                            try
636
                            {
637
                                if (pdfFormFields.GenerateAppearances != true)
638
                                {
639
                                    pdfFormFields.GenerateAppearances = true;
640
                                }
641
                            }
642
                            catch (Exception ex)
643
                            {
644
                                SetNotice(FinalItem.ID, "this pdf is not AcroForm.");
645
                            }
646

    
647
                            var _SetColor = new SolidColorBrush(Colors.Red);
648

    
649
                            string[] delimiterChars = { "|DZ|" };
650
                            string[] delimiterChars2 = { "|" };
651

    
652
                            //pdfStamper.FormFlattening = true; //이미 선처리 작업함
653
                            pdfStamper.SetFullCompression();
654
                            _SetColor = new SolidColorBrush(Colors.Red);
655

    
656
                            foreach (var markupItem in MarkupDataSet)
657
                            {
658
                                pdfSize = pdfReader.GetPageSizeWithRotation(markupItem.PAGENUMBER);
659
                                var currentPage = DocPageItem.Where(d => d.PAGE_NUMBER == markupItem.PAGENUMBER).FirstOrDefault();
660

    
661
                                mediaBox = pdfReader.GetPageSize(markupItem.PAGENUMBER);
662
                                var cropBox = pdfReader.GetCropBox(markupItem.PAGENUMBER);                                
663

    
664
                                /// media box와 crop box가 다를 경우 media box를 crop box와 일치시킨다
665
                                if (cropBox != null && 
666
                                    (cropBox.Left != mediaBox.Left || cropBox.Top != mediaBox.Top || cropBox.Right != mediaBox.Right || cropBox.Bottom != mediaBox.Bottom))
667
                                {
668
                                    PdfDictionary dict = pdfReader.GetPageN(markupItem.PAGENUMBER);
669

    
670
                                    PdfArray oNewMediaBox = new PdfArray();
671
                                    oNewMediaBox.Add(new PdfNumber(cropBox.Left));
672
                                    oNewMediaBox.Add(new PdfNumber(cropBox.Top));
673
                                    oNewMediaBox.Add(new PdfNumber(cropBox.Right));
674
                                    oNewMediaBox.Add(new PdfNumber(cropBox.Bottom));
675
                                    dict.Put(PdfName.MEDIABOX, oNewMediaBox);
676

    
677
                                    pdfSize = cropBox; 
678
                                }
679
                                scaleWidth = float.Parse(currentPage.PAGE_WIDTH) / pdfSize.Width;
680
                                scaleHeight = float.Parse(currentPage.PAGE_HEIGHT) / pdfSize.Height;
681

    
682
                                pdfLink.CURRENT_PAGE = markupItem.PAGENUMBER;
683
                                _entity.SaveChanges();
684

    
685
                                string[] markedData = markupItem.DATA.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
686

    
687
                                PdfContentByte contentByte = pdfStamper.GetOverContent(markupItem.PAGENUMBER);
688

    
689
                                foreach (var data in markedData)
690
                                {
691
                                    var item = JsonSerializerHelper.UnCompressString(data);
692
                                    var ControlT = JsonSerializerHelper.JsonDeserialize<S_BaseControl>(item);
693
                              
694
                                    try
695
                                    {
696
                                        switch (ControlT.Name)
697
                                        {
698
                                            #region LINE
699
                                            case "LineControl":
700
                                                {
701
                                                    using (S_LineControl control = JsonSerializerHelper.JsonDeserialize<S_LineControl>(item))
702
                                                    {
703
                                                        DrawLine(control, contentByte, delimiterChars, delimiterChars2, _SetColor);
704
                                                    }
705
                                                }
706
                                                break;
707
                                            #endregion
708
                                            #region ArrowControlMulti
709
                                            case "ArrowControl_Multi":
710
                                                {
711
                                                    using (S_ArrowControl_Multi control = JsonSerializerHelper.JsonDeserialize<S_ArrowControl_Multi>(item))
712
                                                    {
713
                                                       DrawMultiArrowLine(control, contentByte, delimiterChars, delimiterChars2, _SetColor);
714
                                                    }
715
                                                }
716
                                                break;
717
                                            #endregion
718
                                            #region PolyControl
719
                                            case "PolygonControl":
720
                                                using (S_PolyControl control = JsonSerializerHelper.JsonDeserialize<S_PolyControl>(item))
721
                                                {
722
                                                    string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
723
                                                    Point StartPoint = GetPdfPointSystem(control.StartPoint);
724
                                                    Point EndPoint = GetPdfPointSystem(control.EndPoint);
725
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
726
                                                    double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First()));
727
                                                    double Opacity = control.Opac;
728
                                                    DoubleCollection DashSize = control.DashSize;
729

    
730
                                                    Controls_PDF.DrawSet_Line.DrawLine(PointSet, LineSize, contentByte, DashSize, _SetColor, Opacity);
731
                                                }
732
                                                break;
733
                                            #endregion
734
                                            #region ArcControl or ArrowArcControl
735
                                            case "ArcControl":
736
                                            case "ArrowArcControl":
737
                                                {
738
                                                    using (S_ArcControl control = JsonSerializerHelper.JsonDeserialize<S_ArcControl>(item))
739
                                                    {
740
                                                        string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
741
                                                        Point StartPoint = GetPdfPointSystem(control.StartPoint);
742
                                                        Point EndPoint = GetPdfPointSystem(control.EndPoint);
743
                                                        Point MidPoint = GetPdfPointSystem(control.MidPoint);
744
                                                        DoubleCollection DashSize = control.DashSize;
745
                                                        List<Point> PointSet = GetPdfPointSystem(control.PointSet);
746

    
747
                                                        var Opacity = control.Opac;
748
                                                        string UserID = control.UserID;
749
                                                        double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First()));
750
                                                        bool IsTransOn = control.IsTransOn;
751

    
752
                                                        if (control.IsTransOn)
753
                                                        {
754
                                                            Controls_PDF.DrawSet_Arrow.SingleAllow(MidPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity, true);
755
                                                            Controls_PDF.DrawSet_Arrow.SingleAllow(MidPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity, true);
756
                                                        }
757
                                                        else
758
                                                        {
759
                                                            Controls_PDF.DrawSet_Arc.DrawArc(StartPoint, MidPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity);
760
                                                        }
761

    
762
                                                        if (ControlT.Name == "ArrowArcControl")
763
                                                        {
764
                                                            Controls_PDF.DrawSet_Arrow.SingleAllow(StartPoint, MidPoint, LineSize, contentByte, _SetColor, Opacity);
765
                                                            Controls_PDF.DrawSet_Arrow.SingleAllow(EndPoint, MidPoint, LineSize, contentByte, _SetColor, Opacity);
766
                                                        }
767
                                                    }
768
                                                }
769
                                                break;
770
                                            #endregion
771
                                            #region RectangleControl
772
                                            case "RectangleControl":
773
                                                using (S_RectControl control = JsonSerializerHelper.JsonDeserialize<S_RectControl>(item))
774
                                                {
775
                                                    string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
776
                                                    double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
777
                                                    var PaintStyle = control.PaintState;
778
                                                    double Angle = control.Angle;
779
                                                    DoubleCollection DashSize = control.DashSize;
780
                                                    double Opacity = control.Opac;
781
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
782

    
783
                                                    Controls_PDF.DrawSet_Shape.DrawRectangle(PointSet, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity);
784
                                                }
785
                                                break;
786
                                            #endregion
787
                                            #region TriControl
788
                                            case "TriControl":
789
                                                using (S_TriControl control = JsonSerializerHelper.JsonDeserialize<S_TriControl>(item))
790
                                                {
791
                                                    string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
792
                                                    double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
793
                                                    var PaintStyle = control.Paint;
794
                                                    double Angle = control.Angle;
795
                                                    //StrokeColor = _SetColor, //색상은 레드
796
                                                    DoubleCollection DashSize = control.DashSize;
797
                                                    double Opacity = control.Opac;
798
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
799

    
800
                                                    Controls_PDF.DrawSet_Shape.DrawPolygon(PointSet, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity);
801
                                                }
802
                                                break;
803
                                            #endregion
804
                                            #region CircleControl
805
                                            case "CircleControl":
806
                                                using (S_CircleControl control = JsonSerializerHelper.JsonDeserialize<S_CircleControl>(item))
807
                                                {
808
                                                    string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
809
                                                    double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
810
                                                    var StartPoint = GetPdfPointSystem(control.StartPoint);
811
                                                    var EndPoint = GetPdfPointSystem(control.EndPoint);
812
                                                    var PaintStyle = control.PaintState;
813
                                                    double Angle = control.Angle;
814
                                                    DoubleCollection DashSize = control.DashSize;
815
                                                    double Opacity = control.Opac;
816
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
817
                                                    Controls_PDF.DrawSet_Shape.DrawCircle(StartPoint, EndPoint, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity, Angle, PointSet);
818

    
819
                                                }
820
                                                break;
821
                                            #endregion
822
                                            #region RectCloudControl
823
                                            case "RectCloudControl":
824
                                                using (S_RectCloudControl control = JsonSerializerHelper.JsonDeserialize<S_RectCloudControl>(item))
825
                                                {
826
                                                    string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
827
                                                    double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
828
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
829
                                                    double size = MathSet.DistanceTo(GetPdfPointSystem(control.StartPoint), GetPdfPointSystem(control.EndPoint));
830

    
831
                                                    double ArcLength = (control.ArcLength == 0 ? 10 : control.ArcLength) / (scaleWidth > scaleHeight ? scaleWidth : scaleHeight);
832

    
833
                                                    var PaintStyle = control.PaintState;
834
                                                    double Opacity = control.Opac;
835
                                                    DoubleCollection DashSize = control.DashSize;
836

    
837
                                                    //드로잉 방식이 표현되지 않음
838
                                                    var rrrr = returnAngle(GetPdfPointSystem(control.StartPoint), GetPdfPointSystem(control.EndPoint));
839

    
840
                                                    double area = MathSet.AreaOf(GetPdfPointSystem(control.PointSet));
841
                                                    bool reverse = (area < 0);
842
                                                    if (PaintStyle == PaintSet.None)
843
                                                    {
844
                                                        Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
845
                                                    }
846
                                                    else
847
                                                    {
848
                                                        Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
849
                                                    }
850
                                                }
851
                                                break;
852
                                            #endregion
853
                                            #region CloudControl
854
                                            case "CloudControl":
855
                                                using (S_CloudControl control = JsonSerializerHelper.JsonDeserialize<S_CloudControl>(item))
856
                                                {
857
                                                    string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
858
                                                    double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
859
                                                    double Toler = control.Toler;
860
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
861
                                                    double ArcLength = (control.ArcLength == 0 ? 10 : control.ArcLength) / (scaleWidth > scaleHeight ? scaleWidth : scaleHeight);
862
                                                    var PaintStyle = control.PaintState;
863
                                                    double Opacity = control.Opac;
864
                                                    bool isTransOn = control.IsTrans;
865
                                                    bool isChain = control.IsChain;
866

    
867
                                                    DoubleCollection DashSize = control.DashSize;
868

    
869
                                                    if (isChain)
870
                                                    {
871
                                                        Controls_PDF.DrawSet_Line.DrawLine(PointSet, LineSize, contentByte, DashSize, _SetColor, Opacity);
872
                                                    }
873
                                                    else
874
                                                    {
875
                                                        if (isTransOn)
876
                                                        {
877
                                                            double area = MathSet.AreaOf(GetPdfPointSystem(control.PointSet));
878
                                                            bool reverse = (area < 0);
879

    
880
                                                            if (PaintStyle == PaintSet.None)
881
                                                            {
882
                                                                Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
883
                                                            }
884
                                                            else
885
                                                            {
886
                                                                Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
887
                                                            }
888
                                                        }
889
                                                        else
890
                                                        {
891
                                                            Controls_PDF.DrawSet_Shape.DrawPolygon(PointSet, LineSize, contentByte, control.DashSize, _SetColor, PaintStyle, Opacity);
892
                                                        }
893
                                                    }
894
                                                }
895
                                                break;
896
                                            #endregion
897
                                            #region TEXT
898
                                            case "TextControl":
899
                                                using (S_TextControl control = JsonSerializerHelper.JsonDeserialize<S_TextControl>(item))
900
                                                {
901
                                                    DrawTextBox(control, contentByte, delimiterChars, delimiterChars2, _SetColor);
902
                                                 }
903
                                                break;
904
                                            #endregion
905
                                            #region ArrowTextControl
906
                                            case "ArrowTextControl":
907
                                                using (S_ArrowTextControl control = JsonSerializerHelper.JsonDeserialize<S_ArrowTextControl>(item))
908
                                                {
909
                                                    //using (S_TextControl textcontrol = JsonSerializerHelper.JsonDeserialize<S_TextControl>(item))
910
                                                    //{
911
                                                    //    textcontrol.Angle = control.Angle;
912
                                                    //    textcontrol.BoxH = control.BoxHeight;
913
                                                    //    textcontrol.BoxW = control.BoxWidth;
914
                                                    //    textcontrol.EndPoint = control.EndPoint;
915
                                                    //    textcontrol.FontColor = "#FFFF0000";
916
                                                    //    textcontrol.Name = "TextControl";
917
                                                    //    textcontrol.Opac = control.Opac;
918
                                                    //    textcontrol.PointSet = new List<Point>();
919
                                                    //    textcontrol.SizeSet = string.Join(delimiterChars2.First(), control.SizeSet.First(), control.fontConfig[3]);
920
                                                    //    textcontrol.StartPoint = control.StartPoint;
921
                                                    //    textcontrol.Text = control.ArrowText;
922
                                                    //    textcontrol.TransformPoint = control.TransformPoint;
923
                                                    //    textcontrol.UserID = null;
924
                                                    //    textcontrol.fontConfig = control.fontConfig;
925
                                                    //    textcontrol.isHighLight = control.isHighLight;
926
                                                    //    textcontrol.paintMethod = 1;
927

    
928
                                                    //    DrawTextBox(textcontrol, contentByte, delimiterChars, delimiterChars2, _SetColor);
929
                                                    //}
930

    
931
                                                    //using (S_ArrowControl_Multi linecontrol = JsonSerializerHelper.JsonDeserialize<S_ArrowControl_Multi>(item))
932
                                                    //{
933
                                                    //    linecontrol.Angle = control.Angle;
934
                                                    //    linecontrol.DashSize = new DoubleCollection(new[] {(double)999999 });
935
                                                    //    linecontrol.EndPoint = control.EndPoint;
936
                                                    //    linecontrol.MidPoint = control.MidPoint;
937
                                                    //    linecontrol.Name = "ArrowControl_Multi";
938
                                                    //    linecontrol.Opac = control.Opac;
939
                                                    //    linecontrol.PointSet = control.PointSet;
940
                                                    //    linecontrol.SizeSet = control.SizeSet;
941
                                                    //    linecontrol.StartPoint = control.StartPoint;
942
                                                    //    linecontrol.StrokeColor = control.StrokeColor;
943
                                                    //    linecontrol.TransformPoint = control.TransformPoint;
944

    
945
                                                    //    DrawMultiArrowLine(linecontrol, contentByte, delimiterChars, delimiterChars2, _SetColor);
946
                                                    //}
947
                                                string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
948
                                                Point tempStartPoint = GetPdfPointSystem(control.StartPoint);
949
                                                Point tempMidPoint = GetPdfPointSystem(control.MidPoint);
950
                                                Point tempEndPoint = GetPdfPointSystem(control.EndPoint);
951
                                                bool isUnderLine = false;
952
                                                string Text = "";
953
                                                double fontsize = 30;
954

    
955
                                                System.Drawing.SizeF sizeF = new System.Drawing.SizeF((float)control.BoxWidth, (float)control.BoxHeight);
956
                                                Rect rect = new Rect(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight));
957
                                                List<Point> tempPoint = new List<Point>();
958

    
959
                                                double Angle = control.Angle;
960

    
961
                                                if (Math.Abs(Angle).ToString() == "90")
962
                                                {
963
                                                    Angle = 270;
964
                                                }
965
                                                else if (Math.Abs(Angle).ToString() == "270")
966
                                                {
967
                                                    Angle = 90;
968
                                                }
969

    
970
                                                var tempRectMidPoint = MathSet.getRectMiddlePoint(rect);
971
                                                tempPoint.Add(new Point(rect.Left, tempRectMidPoint.Y));
972
                                                tempPoint.Add(new Point(tempRectMidPoint.X, rect.Top));
973
                                                tempPoint.Add(new Point(rect.Right, tempRectMidPoint.Y));
974
                                                tempPoint.Add(new Point(tempRectMidPoint.X, rect.Bottom));
975

    
976
                                                var newStartPoint = tempStartPoint;
977
                                                var newEndPoint = MathSet.getNearPoint(tempPoint, tempMidPoint);
978
                                                var newMidPoint = MathSet.getMiddlePoint(newStartPoint, newEndPoint);
979

    
980
                                                    //Point testPoint = tempEndPoint;
981
                                                    //if (Angle != 0)
982
                                                    //{
983
                                                    //    testPoint = GetArrowTextControlTestPoint(0, newMidPoint, tempPoint, control.isFixed);
984
                                                    //   //testPoint = Test(rect, newMidPoint);
985
                                                    //}
986

    
987
                                                double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
988
                                                SolidColorBrush FontColor = _SetColor;
989
                                                bool isHighlight = control.isHighLight;
990
                                                double Opacity = control.Opac;
991
                                                PaintSet Paint = PaintSet.None;
992

    
993
                                                switch (control.ArrowStyle)
994
                                                {
995
                                                    case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Normal:
996
                                                        {
997
                                                            Paint = PaintSet.None;
998
                                                        }
999
                                                        break;
1000
                                                    case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud:
1001
                                                        {
1002
                                                            Paint = PaintSet.Hatch;
1003
                                                        }
1004
                                                        break;
1005
                                                    case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect:
1006
                                                        {
1007
                                                            Paint = PaintSet.Fill;
1008
                                                        }
1009
                                                        break;
1010
                                                    default:
1011
                                                        break;
1012
                                                }
1013
                                                if (control.isHighLight) Paint |= PaintSet.Highlight;
1014

    
1015
                                                if (Paint == PaintSet.Hatch)
1016
                                                {
1017
                                                    Text = control.ArrowText;
1018
                                                }
1019
                                                else
1020
                                                {
1021
                                                    Text = control.ArrowText;
1022
                                                }
1023

    
1024
                                                try
1025
                                                {
1026
                                                    if (control.fontConfig.Count == 4)
1027
                                                    {
1028
                                                        fontsize = Convert.ToDouble(control.fontConfig[3]);
1029
                                                    }
1030

    
1031
                                                    //강인구 수정(2018.04.17)
1032
                                                    var TextStyle = Common.StringToFont.ConFontStyle(control.fontConfig[1]);
1033

    
1034
                                                    FontStyle fontStyle = FontStyles.Normal;
1035
                                                    if (FontStyles.Italic == TextStyle)
1036
                                                    {
1037
                                                        fontStyle = FontStyles.Italic;
1038
                                                    }
1039

    
1040
                                                    FontWeight fontWeight = FontWeights.Black;
1041

    
1042
                                                    var TextWeight = Common.StringToFont.ConFontWeight(control.fontConfig[2]);
1043
                                                    if (FontWeights.Bold == TextWeight)
1044
                                                    {
1045
                                                        fontWeight = FontWeights.Bold;
1046
                                                    }
1047

    
1048
                                                    TextDecorationCollection decoration = TextDecorations.Baseline;
1049
                                                    if (control.fontConfig.Count() == 5)
1050
                                                    {
1051
                                                        decoration = TextDecorations.Underline;
1052
                                                    }
1053

    
1054
                                                    if (control.isTrans)
1055
                                                    {
1056
                                                            //인구 수정 Arrow Text Style적용 되도록 변경
1057
                                                            Controls_PDF.DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
1058
                                                            newStartPoint, tempMidPoint, newEndPoint, control.isFixed,
1059
                                                            LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, FontHelper.GetFontFamily(control.fontConfig[0]), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
1060
                                                    }
1061
                                                    else
1062
                                                    {
1063
                                                        if (control.isFixed)
1064
                                                        {
1065
                                                            var testP = new Point(0, 0);
1066
                                                            if (control.isFixed)
1067
                                                            {
1068
                                                                if (tempPoint[1] == newEndPoint)
1069
                                                                {
1070
                                                                    testP = new Point(newEndPoint.X, newEndPoint.Y - 10);
1071
                                                                }
1072
                                                                else if (tempPoint[3] == newEndPoint)
1073
                                                                {
1074
                                                                    testP = new Point(newEndPoint.X, newEndPoint.Y + 10);
1075
                                                                }
1076
                                                                else if (tempPoint[0] == newEndPoint)
1077
                                                                {
1078
                                                                    testP = new Point(newEndPoint.X - 10, newEndPoint.Y);
1079
                                                                }
1080
                                                                else if (tempPoint[2] == newEndPoint)
1081
                                                                {
1082
                                                                    testP = new Point(newEndPoint.X + 10, newEndPoint.Y);
1083
                                                                }
1084
                                                            }
1085
                                                            //인구 수정 Arrow Text Style적용 되도록 변경
1086
                                                            Controls_PDF.DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
1087
                                                                tempStartPoint, testP, tempEndPoint, control.isFixed,
1088
                                                                LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight,
1089
                                                            FontHelper.GetFontFamily(control.fontConfig[0]), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
1090
                                                        }
1091
                                                        else
1092
                                                        {
1093
                                                            //인구 수정 Arrow Text Style적용 되도록 변경
1094
                                                            Controls_PDF.DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
1095
                                                                newStartPoint, tempMidPoint, tempEndPoint, control.isFixed,
1096
                                                                LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, FontHelper.GetFontFamily(control.fontConfig[0]), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
1097
                                                        }
1098
                                                    }
1099
                                                }
1100
                                                catch (Exception ex)
1101
                                                {
1102
                                                    throw ex;
1103
                                                }
1104

    
1105
                                                }
1106
                                                break;
1107
                                            #endregion
1108
                                            #region SignControl
1109
                                            case "SignControl":
1110
                                                using (S_SignControl control = JsonSerializerHelper.JsonDeserialize<S_SignControl>(item))
1111
                                                {
1112

    
1113
                                                    double Angle = control.Angle;
1114
                                                    Point StartPoint = GetPdfPointSystem(control.StartPoint);
1115
                                                    Point TopRightPoint = GetPdfPointSystem(control.TR);
1116
                                                    Point EndPoint = GetPdfPointSystem(control.EndPoint);
1117
                                                    Point LeftBottomPoint = GetPdfPointSystem(control.LB);
1118
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
1119
                                                    double Opacity = control.Opac;
1120
                                                    string UserNumber = control.UserNumber;
1121
                                                    Controls_PDF.DrawSet_Image.DrawSign(StartPoint, EndPoint, PointSet, contentByte, UserNumber, Angle, Opacity, finaldata.PROJECT_NO);
1122
                                                }
1123
                                                break;
1124
                                            #endregion
1125
                                            #region MyRegion
1126
                                            case "DateControl":
1127
                                                using (S_DateControl control = JsonSerializerHelper.JsonDeserialize<S_DateControl>(item))
1128
                                                {
1129
                                                    string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
1130
                                                    string Text = control.Text;
1131
                                                    Point StartPoint = GetPdfPointSystem(control.StartPoint);
1132
                                                    Point EndPoint = GetPdfPointSystem(control.EndPoint);
1133
                                                    List<Point> pointSet = GetPdfPointSystem(control.PointSet);
1134
                                                    SolidColorBrush FontColor = _SetColor;
1135
                                                    double Angle = control.Angle;
1136
                                                    double Opacity = control.Opac;
1137
                                                    Controls_PDF.PDFLib_DrawSet_Text.DrawDate(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Text, Angle, Opacity);
1138
                                                }
1139
                                                break;
1140
                                            #endregion
1141
                                            #region SymControlN (APPROVED)
1142
                                            case "SymControlN":
1143
                                                using (S_SymControl control = JsonSerializerHelper.JsonDeserialize<S_SymControl>(item))
1144
                                                {
1145
                                                    Point StartPoint = GetPdfPointSystem(control.StartPoint);
1146
                                                    Point EndPoint = GetPdfPointSystem(control.EndPoint);
1147
                                                    List<Point> pointSet = GetPdfPointSystem(control.PointSet);
1148
                                                    SolidColorBrush FontColor = _SetColor;
1149
                                                    double Angle = control.Angle;
1150
                                                    double Opacity = control.Opac;
1151

    
1152
                                                    var stamp = _entity.PROPERTIES.Where(x => x.TYPE == "STAMP");
1153

    
1154
                                                    if (stamp.Count() > 0)
1155
                                                    {
1156
                                                        var xamldata = Serialize.Core.JsonSerializerHelper.UnCompressString_NonPrefix(stamp.First().VALUE);
1157

    
1158
                                                        Controls_PDF.PDFLib_DrawSet_Symbol.DrawApprovalXamlData(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Angle, Opacity, xamldata);
1159
                                                    }
1160

    
1161
                                                    string imgpath = CommonLib.Common.GetConfigString("ApprovedImgPath", "URL", "");
1162
                                                    
1163
                                                }
1164
                                                break;
1165
                                            case "SymControl":
1166
                                                using (S_SymControl control = JsonSerializerHelper.JsonDeserialize<S_SymControl>(item))
1167
                                                {
1168
                                                    Point StartPoint = GetPdfPointSystem(control.StartPoint);
1169
                                                    Point EndPoint = GetPdfPointSystem(control.EndPoint);
1170
                                                    List<Point> pointSet = GetPdfPointSystem(control.PointSet);
1171
                                                    SolidColorBrush FontColor = _SetColor;
1172
                                                    double Angle = control.Angle;
1173
                                                    double Opacity = control.Opac;
1174

    
1175
                                                    string imgpath = CommonLib.Common.GetConfigString("CheckmarkImgPath", "URL", "");
1176
                                                    Controls_PDF.PDFLib_DrawSet_Symbol.DrawCheckMark(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Angle, Opacity, imgpath);
1177
                                                }
1178
                                                break;
1179
                                            #endregion
1180
                                            #region Image
1181
                                            case "ImgControl":
1182
                                                using (S_ImgControl control = JsonSerializerHelper.JsonDeserialize<S_ImgControl>(item))
1183
                                                {
1184
                                                    double Angle = control.Angle;
1185
                                                    Point StartPoint = GetPdfPointSystem(control.StartPoint);
1186
                                                    Point TopRightPoint = GetPdfPointSystem(control.TR);
1187
                                                    Point EndPoint = GetPdfPointSystem(control.EndPoint);
1188
                                                    Point LeftBottomPoint = GetPdfPointSystem(control.LB);
1189
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
1190
                                                    double Opacity = control.Opac;
1191
                                                    string FilePath = control.ImagePath;
1192
                                                    //Uri uri = new Uri(s.ImagePath);
1193

    
1194
                                                    Controls_PDF.DrawSet_Image.DrawImage(StartPoint, EndPoint, PointSet, contentByte, FilePath, Angle, Opacity);
1195
                                                }
1196
                                                break;
1197
                                            #endregion
1198
                                            default:
1199
                                                StatusChange($"{ControlT.Name} Not Support", 0);
1200
                                                break;
1201
                                        }
1202
                                        
1203
                                    }
1204
                                    catch (Exception ex)
1205
                                    {
1206
                                        StatusChange($"markupItem : {markupItem.ID}" + ex.ToString(), 0);
1207
                                    }
1208
                                }
1209
                            }
1210
                            pdfStamper.Outlines = root;
1211
                            pdfStamper.Close();
1212
                            pdfReader.Close();
1213
                        }
1214
                    }
1215
                    #endregion
1216
                }
1217
                if (tempFileInfo.Exists)
1218
                {
1219
                    tempFileInfo.Delete();
1220
                }
1221

    
1222
                if (File.Exists(pdfFilePath))
1223
                {
1224
                    string destfilepath = null;
1225
                    try
1226
                    {
1227
                        FinalPDFPath = new FileInfo(pdfFilePath);
1228

    
1229
                        //  string pdfmovepath = CommonLib.Common.GetConfigString("PDFMovePath", "URL", "");
1230
                        destfilepath = Path.Combine(_FinalPDFStorgeLocal, FinalPDFPath.Name.Replace(".tmp", ".pdf"));
1231

    
1232
                        if (File.Exists(destfilepath))
1233
                            File.Delete(destfilepath);
1234

    
1235
                        File.Move(FinalPDFPath.FullName, destfilepath);
1236
                        FinalPDFPath = new FileInfo(destfilepath);
1237
                        File.Delete(pdfFilePath);
1238
                    }
1239
                    catch (Exception ex)
1240
                    {
1241
                        SetNotice(finaldata.ID, $"File move error - Source File : {FinalPDFPath.FullName} dest File : {destfilepath}" + ex.ToString());
1242
                    }
1243

    
1244
                    return true;
1245
                }
1246
            }
1247
            catch (Exception ex)
1248
            {
1249
                SetNotice(finaldata.ID, "SetStempinPDF error: " + ex.ToString());
1250
            }
1251
            return false;
1252
        }
1253

    
1254
        /// <summary>
1255
        /// kcom의 화살표방향과 틀려 추가함
1256
        /// </summary>
1257
        /// <param name="PageAngle"></param>
1258
        /// <param name="endP"></param>
1259
        /// <param name="ps">box Points</param>
1260
        /// <param name="IsFixed"></param>
1261
        /// <returns></returns>
1262
        private Point GetArrowTextControlTestPoint(double PageAngle,Point endP,List<Point> ps,bool IsFixed)
1263
        {
1264
            Point testP = endP;
1265

    
1266
            try
1267
            {
1268
                switch (Math.Abs(PageAngle).ToString())
1269
                {
1270
                    case "90":
1271
                        testP = new Point(endP.X + 50, endP.Y);
1272
                        break;
1273
                    case "270":
1274
                        testP = new Point(endP.X - 50, endP.Y);
1275
                        break;
1276
                }
1277

    
1278
                //20180910 LJY 각도에 따라.
1279
                switch (Math.Abs(PageAngle).ToString())
1280
                {
1281
                    case "90":
1282
                        if (IsFixed)
1283
                        {
1284
                            if (ps[0] == endP) //상단
1285
                            {
1286
                                testP = new Point(endP.X, endP.Y + 50);
1287
                                //System.Diagnostics.Debug.WriteLine("상단"+ testP);
1288
                            }
1289
                            else if (ps[1] == endP) //하단
1290
                            {
1291
                                testP = new Point(endP.X, endP.Y - 50);
1292
                                //System.Diagnostics.Debug.WriteLine("하단"+ testP);
1293
                            }
1294
                            else if (ps[2] == endP) //좌단
1295
                            {
1296
                                testP = new Point(endP.X - 50, endP.Y);
1297
                                //System.Diagnostics.Debug.WriteLine("좌단"+ testP);
1298
                            }
1299
                            else if (ps[3] == endP) //우단
1300
                            {
1301
                                testP = new Point(endP.X + 50, endP.Y);
1302
                                //System.Diagnostics.Debug.WriteLine("우단"+ testP);
1303
                            }
1304
                        }
1305
                        break;
1306
                    case "270":
1307
                        if (IsFixed)
1308
                        {
1309
                            if (ps[0] == endP) //상단
1310
                            {
1311
                                testP = new Point(endP.X, endP.Y - 50);
1312
                                //System.Diagnostics.Debug.WriteLine("상단" + testP);
1313
                            }
1314
                            else if (ps[1] == endP) //하단
1315
                            {
1316
                                testP = new Point(endP.X, endP.Y + 50);
1317
                                //System.Diagnostics.Debug.WriteLine("하단" + testP);
1318
                            }
1319
                            else if (ps[2] == endP) //좌단
1320
                            {
1321
                                testP = new Point(endP.X + 50, endP.Y);
1322
                                //System.Diagnostics.Debug.WriteLine("좌단" + testP);
1323
                            }
1324
                            else if (ps[3] == endP) //우단
1325
                            {
1326
                                testP = new Point(endP.X - 50, endP.Y);
1327
                                //System.Diagnostics.Debug.WriteLine("우단" + testP);
1328
                            }
1329
                        }
1330
                        break;
1331
                    default:
1332
                        if (IsFixed)
1333
                        {
1334

    
1335
                            if (ps[0] == endP) //상단
1336
                            {
1337
                                testP = new Point(endP.X, endP.Y - 50);
1338
                                //System.Diagnostics.Debug.WriteLine("상단");
1339
                            }
1340
                            else if (ps[1] == endP) //하단
1341
                            {
1342
                                testP = new Point(endP.X, endP.Y + 50);
1343
                                //System.Diagnostics.Debug.WriteLine("하단");
1344
                            }
1345
                            else if (ps[2] == endP) //좌단
1346
                            {
1347
                                testP = new Point(endP.X - 50, endP.Y);
1348
                                //System.Diagnostics.Debug.WriteLine("좌단");
1349
                            }
1350
                            else if (ps[3] == endP) //우단
1351
                            {
1352
                                testP = new Point(endP.X + 50, endP.Y);
1353
                                //System.Diagnostics.Debug.WriteLine("우단");
1354
                            }
1355
                        }
1356
                        break;
1357
                }
1358

    
1359
            }
1360
            catch (Exception)
1361
            {
1362
            }
1363

    
1364
            return testP;
1365
        }
1366

    
1367
        private Point Test(Rect rect,Point point)
1368
        {
1369
            Point result = new Point();
1370

    
1371
            Point newPoint = new Point();
1372

    
1373
            double oldNear = 0;
1374
            double newNear = 0;
1375

    
1376
            oldNear = MathSet.GetShortestDistance(point, rect.TopLeft, rect.TopRight, out result);
1377

    
1378
            newNear = MathSet.GetShortestDistance(point, rect.TopLeft, rect.BottomLeft, out newPoint);
1379

    
1380
            if (newNear < oldNear)
1381
            {
1382
                oldNear = newNear;
1383
                result = newPoint;
1384
            }
1385

    
1386
            newNear = MathSet.GetShortestDistance(point, rect.TopRight, rect.BottomRight, out newPoint);
1387

    
1388
            if (newNear < oldNear)
1389
            {
1390
                oldNear = newNear;
1391
                result = newPoint;
1392
            }
1393

    
1394

    
1395
            newNear = MathSet.GetShortestDistance(point, rect.BottomLeft, rect.BottomRight, out newPoint);
1396

    
1397
            if (newNear < oldNear)
1398
            {
1399
                oldNear = newNear;
1400
                result = newPoint;
1401
            }
1402

    
1403
            return result;
1404
        }
1405

    
1406
        private void DrawMultiArrowLine(S_ArrowControl_Multi control, PdfContentByte contentByte, string[] delimiterChars, string[] delimiterChars2, SolidColorBrush setColor)
1407
        {
1408
            string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
1409
            Point StartPoint = GetPdfPointSystem(control.StartPoint);
1410
            Point MidPoint = GetPdfPointSystem(control.MidPoint);
1411
            Point EndPoint = GetPdfPointSystem(control.EndPoint);
1412
            DoubleCollection DashSize = control.DashSize;
1413
            List<Point> PointSet = GetPdfPointSystem(control.PointSet);
1414
            double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First()));
1415

    
1416
            double Opacity = control.Opac;
1417

    
1418
            if (EndPoint == MidPoint)
1419
            {
1420
                Controls_PDF.DrawSet_Arrow.SingleAllow(MidPoint, StartPoint, LineSize, contentByte, setColor, Opacity);
1421
            }
1422
            else
1423
            {
1424
                Controls_PDF.DrawSet_Arrow.SingleAllow(EndPoint, MidPoint, LineSize, contentByte, setColor, Opacity);
1425
            }
1426

    
1427
            Controls_PDF.DrawSet_Line.DrawLine(PointSet, LineSize, contentByte, DashSize, setColor, Opacity);
1428

    
1429
        }
1430

    
1431
        private void DrawLine(S_LineControl control, PdfContentByte contentByte, string[] delimiterChars, string[] delimiterChars2, SolidColorBrush setColor)
1432
        {
1433
            string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
1434
            Point StartPoint = GetPdfPointSystem(control.StartPoint);
1435
            Point EndPoint = GetPdfPointSystem(control.EndPoint);
1436
            DoubleCollection DashSize = control.DashSize;
1437
            List<Point> PointSet = GetPdfPointSystem(control.PointSet);
1438

    
1439
            var Opacity = control.Opac;
1440
            string UserID = control.UserID;
1441
            double Interval = control.Interval;
1442
            double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First()));
1443
            Controls_PDF.DrawSet_Line.DrawLine(StartPoint, EndPoint, LineSize, contentByte, control.DashSize, setColor, Opacity);
1444
            switch (control.LineStyleSet)
1445
            {
1446
                case LineStyleSet.ArrowLine:
1447
                    Controls_PDF.DrawSet_Arrow.SingleAllow(EndPoint, StartPoint, LineSize, contentByte, setColor, Opacity);
1448
                    break;
1449
                case LineStyleSet.CancelLine:
1450
                    {
1451
                        var x = Math.Abs((Math.Abs(StartPoint.X) - Math.Abs(EndPoint.X)));
1452
                        var y = Math.Abs((Math.Abs(StartPoint.Y) - Math.Abs(EndPoint.Y)));
1453

    
1454
                        if (x > y)
1455
                        {
1456
                            StartPoint = new Point(StartPoint.X, StartPoint.Y - (float)(control.Interval / 3.0));
1457
                            EndPoint = new Point(EndPoint.X, EndPoint.Y - (float)(control.Interval / 3.0));
1458
                            Controls_PDF.DrawSet_Line.DrawLine(StartPoint, EndPoint, LineSize, contentByte, DashSize, setColor, Opacity);
1459
                        }
1460
                    }
1461
                    break;
1462
                case LineStyleSet.TwinLine:
1463
                    {
1464
                        Controls_PDF.DrawSet_Arrow.SingleAllow(EndPoint, StartPoint, LineSize, contentByte, setColor, Opacity);
1465
                        Controls_PDF.DrawSet_Arrow.SingleAllow(StartPoint, EndPoint, LineSize, contentByte, setColor, Opacity);
1466
                    }
1467
                    break;
1468
                case LineStyleSet.DimLine:
1469
                    {
1470
                        Controls_PDF.DrawSet_Arrow.DimAllow(StartPoint, EndPoint, LineSize, contentByte, setColor, Opacity);
1471
                        Controls_PDF.DrawSet_Arrow.SingleAllow(EndPoint, StartPoint, LineSize, contentByte, setColor, Opacity);
1472
                        Controls_PDF.DrawSet_Arrow.SingleAllow(StartPoint, EndPoint, LineSize, contentByte, setColor, Opacity);
1473
                    }
1474
                    break;
1475
                default:
1476
                    break;
1477
            }
1478

    
1479
        }
1480

    
1481
        private void DrawTextBox(S_TextControl control,PdfContentByte contentByte, string[] delimiterChars, string[] delimiterChars2,SolidColorBrush setColor)
1482
        {
1483
            string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
1484
            string Text = control.Text;
1485

    
1486
            bool isUnderline = false;
1487
            control.BoxW -= scaleWidth;
1488
            control.BoxH -= scaleHeight;
1489
            System.Drawing.SizeF sizeF = new System.Drawing.SizeF((float)control.BoxW, (float)control.BoxH);
1490
            Point StartPoint = GetPdfPointSystem(control.StartPoint);
1491
            Point EndPoint = GetPdfPointSystem(new Point(control.StartPoint.X + control.BoxW, control.StartPoint.Y + control.BoxH));
1492

    
1493
            List<Point> pointSet = new List<Point>();
1494
            pointSet.Add(StartPoint);
1495
            pointSet.Add(EndPoint);
1496

    
1497
            PaintSet paint = PaintSet.None;
1498
            switch (control.paintMethod)
1499
            {
1500
                case 1:
1501
                    {
1502
                        paint = PaintSet.Fill;
1503
                    }
1504
                    break;
1505
                case 2:
1506
                    {
1507
                        paint = PaintSet.Hatch;
1508
                    }
1509
                    break;
1510
                default:
1511
                    break;
1512
            }
1513
            if (control.isHighLight) paint |= PaintSet.Highlight;
1514

    
1515
            double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
1516
            double TextSize = Convert.ToDouble(data2[1]);
1517
            SolidColorBrush FontColor = setColor;
1518
            double Angle = control.Angle;
1519
            double Opacity = control.Opac;
1520
            FontFamily fontfamilly = FontHelper.GetFontFamily(control.fontConfig[0]);
1521
            var TextStyle = Common.StringToFont.ConFontStyle(control.fontConfig[1]);
1522

    
1523
            FontStyle fontStyle = FontStyles.Normal;
1524
            if (FontStyles.Italic == TextStyle)
1525
            {
1526
                fontStyle = FontStyles.Italic;
1527
            }
1528

    
1529
            FontWeight fontWeight = FontWeights.Black;
1530

    
1531
            var TextWeight = Common.StringToFont.ConFontWeight(control.fontConfig[2]);
1532
            //강인구 수정(2018.04.17)
1533
            if (FontWeights.Bold == TextWeight)
1534
            //if (FontWeights.ExtraBold == TextWeight)
1535
            {
1536
                fontWeight = FontWeights.Bold;
1537
            }
1538

    
1539
            TextDecorationCollection decoration = TextDecorations.Baseline;
1540
            if (control.fontConfig.Count() == 4)
1541
            {
1542
                decoration = TextDecorations.Underline;
1543
            }
1544

    
1545
            Controls_PDF.DrawSet_Text.DrawString(StartPoint, EndPoint, LineSize, contentByte, setColor, paint, TextSize, fontfamilly, fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
1546
        }
1547
    
1548

    
1549
        ~MarkupToPDF()
1550
        {
1551
            this.Dispose(false);
1552
        }
1553

    
1554
        private bool disposed;
1555

    
1556
        public void Dispose()
1557
        {
1558
            this.Dispose(true);
1559
            GC.SuppressFinalize(this);
1560
        }
1561

    
1562
        protected virtual void Dispose(bool disposing)
1563
        {
1564
            if (this.disposed) return;
1565
            if (disposing)
1566
            {
1567
                // IDisposable 인터페이스를 구현하는 멤버들을 여기서 정리합니다.
1568
            }
1569
            // .NET Framework에 의하여 관리되지 않는 외부 리소스들을 여기서 정리합니다.
1570
            this.disposed = true;
1571
        }
1572

    
1573
        #endregion
1574
    }
1575
}
클립보드 이미지 추가 (최대 크기: 500 MB)