프로젝트

일반

사용자정보

개정판 c206d293

IDc206d293a83ae7d06b951f601e5d0116f242e8d9
상위 872b94b9
하위 24c5e56c

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

- final service
: font 추가

Change-Id: If1a85790055b42b90f397f4e2054acc320c1ed30

차이점 보기:

FinalService/KCOM_FinalService/MarkupToPDF/MarkupToPDF.cs
5 5
using MarkupToPDF.Controls.Common;
6 6
using MarkupToPDF.Serialize.Core;
7 7
using MarkupToPDF.Serialize.S_Control;
8
using Markus.Fonts;
8 9
using System;
9 10
using System.Collections.Generic;
10 11
using System.Configuration;
......
143 144

  
144 145
        #endregion
145 146

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

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

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

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

  
170
                throw;
171
            }
172

  
173
            return result;
174

  
175
        }
176

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

  
153 187
            AddFinalPDFResult result = new AddFinalPDFResult { Success = false };
154 188

  
155 189
            try
......
344 378
                            //{
345 379
                                OriginFileName = _files.First().Name;
346 380
                                PdfFilePath = _files.First().CopyTo(TestFile, true);
381
                                StatusChange($"Copy File  file Count = 1 : {PdfFilePath}", 0);
347 382
                            //}
348 383
                            //else
349 384
                            //{
......
362 397
                            {
363 398
                                OriginFileName = originalFile.Name;
364 399
                                PdfFilePath = originalFile.CopyTo(TestFile, true);
400
                                StatusChange($"Copy File file Count  > 1 : {PdfFilePath}", 0);
365 401
                            }
366 402
                        }
367 403
                        else
......
414 450

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

  
418 456
                        SetStampInPDF(FinalItem, TestFile, MarkupInfoItem);
457

  
458
                        StatusChange($"SetStampInPDF : {TestFile}", 0);
419 459
                    }
420 460
                }
421 461
                if (EndFinal != null)
......
448 488
                FileInfo TestFile = new FileInfo(System.IO.Path.GetTempFileName());
449 489

  
450 490
                PdfReader pdfReader = new PdfReader(tempFileInfo);
491

  
451 492
                for (int i = 1; i <= pdfReader.NumberOfPages; i++)
452 493
                {
453 494
                    var mediaBox = pdfReader.GetPageSize(i);
......
516 557
        {
517 558
            if(StatusChanged != null)
518 559
            {
519
                StatusChanged(null, new StatusChangedEventArgs { CurrentPage = CurrentPage, Message = message });
560
                var sb = new StringBuilder();
561
                sb.AppendLine(message);
562

  
563
                StatusChanged(null, new StatusChangedEventArgs { CurrentPage = CurrentPage, Message = sb.ToString() });
520 564
            }
521 565
        }
522 566

  
......
573 617

  
574 618
                        using (PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(pdfFilePath, FileMode.Create)))
575 619
                        {
620
                            AcroFields pdfFormFields = pdfStamper.AcroFields;
621
                            pdfFormFields.GenerateAppearances = true;
622

  
576 623
                            var _SetColor = new SolidColorBrush(Colors.Red);
577 624

  
578 625
                            string[] delimiterChars = { "|DZ|" };
......
727 774
                                                }
728 775
                                                break;
729 776
                                            #endregion
730
                                            #region ArcControl
777
                                            #region ArcControl or ArrowArcControl
731 778
                                            case "ArcControl":
779
                                            case "ArrowArcControl":
732 780
                                                {
733 781
                                                    using (S_ArcControl control = JsonSerializerHelper.JsonDeserialize<S_ArcControl>(item))
734 782
                                                    {
......
754 802
                                                            Controls_PDF.DrawSet_Arc.DrawArc(StartPoint, MidPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity);
755 803
                                                        }
756 804

  
805
                                                        if (ControlT.Name == "ArrowArcControl")
806
                                                        {
807
                                                            Controls_PDF.DrawSet_Arrow.SingleAllow(StartPoint, MidPoint, LineSize, contentByte, _SetColor, Opacity);
808
                                                            Controls_PDF.DrawSet_Arrow.SingleAllow(EndPoint, MidPoint, LineSize, contentByte, _SetColor, Opacity);
809
                                                        }
757 810
                                                    }
758 811
                                                }
759 812
                                                break;
......
925 978
                                                    SolidColorBrush FontColor = _SetColor;
926 979
                                                    double Angle = control.Angle;
927 980
                                                    double Opacity = control.Opac;
928
                                                    FontFamily fontfamilly = new FontFamily(control.fontConfig[0]);
981
                                                    FontFamily fontfamilly = FontHelper.GetFontFamily(control.fontConfig[0]);
929 982
                                                    var TextStyle = Common.StringToFont.ConFontStyle(control.fontConfig[1]);
930

  
983
                                                    
931 984
                                                    FontStyle fontStyle = FontStyles.Normal;
932 985
                                                    if (FontStyles.Italic == TextStyle)
933 986
                                                    {
......
1053 1106
                                                            //인구 수정 Arrow Text Style적용 되도록 변경
1054 1107
                                                            Controls_PDF.DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
1055 1108
                                                                newStartPoint, tempMidPoint, control.isFixed,
1056
                                                                LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, new FontFamily(control.fontConfig[0]), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
1109
                                                                LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, FontHelper.GetFontFamily(control.fontConfig[0]), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
1057 1110
                                                        }
1058 1111
                                                        else
1059 1112
                                                        {
......
1083 1136
                                                                Controls_PDF.DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
1084 1137
                                                                    tempStartPoint, testP, control.isFixed ,
1085 1138
                                                                    LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight,
1086
                                                                new FontFamily(control.fontConfig[0]), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
1139
                                                                FontHelper.GetFontFamily(control.fontConfig[0]), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
1087 1140
                                                            }
1088 1141
                                                            else
1089 1142
                                                            {
1090 1143
                                                                //인구 수정 Arrow Text Style적용 되도록 변경
1091 1144
                                                                Controls_PDF.DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
1092 1145
                                                                    newStartPoint, tempMidPoint, control.isFixed,
1093
                                                                    LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, new FontFamily(control.fontConfig[0]), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
1146
                                                                    LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, FontHelper.GetFontFamily(control.fontConfig[0]), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
1094 1147
                                                            }
1095 1148
                                                        }
1096 1149
                                                    }
......
1130 1183
                                                    SolidColorBrush FontColor = _SetColor;
1131 1184
                                                    double Angle = control.Angle;
1132 1185
                                                    double Opacity = control.Opac;
1133
                                                    Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawDate(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Text, Angle, Opacity);
1186
                                                    Controls_PDF.PDFLib_DrawSet_Text.DrawDate(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Text, Angle, Opacity);
1134 1187
                                                }
1135 1188
                                                break;
1136 1189
                                            #endregion
......
1145 1198
                                                    double Angle = control.Angle;
1146 1199
                                                    double Opacity = control.Opac;
1147 1200

  
1201
                                                    var stamp = _entity.PROPERTIES.Where(x => x.TYPE == "STAMP");
1202

  
1203
                                                    if (stamp.Count() > 0)
1204
                                                    {
1205
                                                        var xamldata = Serialize.Core.JsonSerializerHelper.UnCompressString_NonPrefix(stamp.First().VALUE);
1206

  
1207
                                                        Controls_PDF.PDFLib_DrawSet_Symbol.DrawApprovalXamlData(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Angle, Opacity, xamldata);
1208
                                                    }
1209

  
1148 1210
                                                    string imgpath = CommonLib.Common.GetConfigString("ApprovedImgPath", "URL", "");
1149
                                                    Controls_PDF.HoneyPDFLib_DrawSet_Symbol.DrawApproval(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Angle, Opacity, imgpath);
1211
                                                    
1150 1212
                                                }
1151 1213
                                                break;
1152 1214
                                            case "SymControl":
......
1160 1222
                                                    double Opacity = control.Opac;
1161 1223

  
1162 1224
                                                    string imgpath = CommonLib.Common.GetConfigString("CheckmarkImgPath", "URL", "");
1163
                                                    Controls_PDF.HoneyPDFLib_DrawSet_Symbol.DrawCheckMark(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Angle, Opacity, imgpath);
1225
                                                    Controls_PDF.PDFLib_DrawSet_Symbol.DrawCheckMark(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Angle, Opacity, imgpath);
1164 1226
                                                }
1165 1227
                                                break;
1166 1228
                                            #endregion
......
1183 1245
                                                break;
1184 1246
                                            #endregion
1185 1247
                                            default:
1248
                                                StatusChange($"{ControlT.Name} Not Support", 0);
1186 1249
                                                break;
1187 1250
                                        }
1188 1251
                                    }
......
1232 1295
            }
1233 1296
            return false;
1234 1297
        }
1298
    
1235 1299

  
1236 1300
        ~MarkupToPDF()
1237 1301
        {

내보내기 Unified diff

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