프로젝트

일반

사용자정보

개정판 4899d460

ID4899d460f67b63c3b72cb30febe733e27402a26b
상위 307b1e82
하위 68350a1c, 0284237b

김동진이(가) 5년 이상 전에 추가함

issue #1018 checkmark control add & image ratio fit

Change-Id: I774c680cf28b8e8cf35e459b2084dc2c8784840c

차이점 보기:

FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/DrawSet_Symbol.cs
81 81
            contentByte.RestoreState();
82 82
        }
83 83

  
84
        public static void DrawCheckMark(Point sp, Point ep, List<Point> pointSet, PdfContentByte contentByte, SolidColorBrush color, double Angle, double opac, string ImgPath)
85
        {
86
            contentByte.SaveState();
87
            BaseColor bs = new BaseColor(color.Color.R, color.Color.G, color.Color.B, color.Color.A);
88
            var midP = MathSet.getMiddlePoint(sp, ep);
89

  
90

  
91
            var Rect3 = GetPointsToRectX(pointSet);
92

  
93
            
94

  
95
            sendReqLog("CheckMarkImgPath", ImgPath);
96
            Image img = Image.GetInstance(new Uri(ImgPath));
97

  
98
            double ratioX = Rect3.Width / (double)img.Width;
99
            double ratioY = Rect3.Height / (double)img.Height;
100

  
101
            double ratio = Math.Min(ratioX, ratioY);
102

  
103
            int newWidth = (int)(img.Width * ratio);
104
            int newHeight = (int)(img.Height * ratio);
105

  
106
            sendReqLog("img.Width", img.Width.ToString());
107
            img.ScaleToFit(newWidth, newHeight);
108

  
109
            img.SetAbsolutePosition((float)midP.X - (newWidth / 2), (float)midP.Y - (newHeight / 2));
110

  
111
            var xxxx = Rect3.Left + ((Rect3.Width - img.ScaledWidth) / 2);
112
            var x = Rect3.Left + ((Rect3.Width - img.ScaledWidth) / 2);
113
            var y = Rect3.Bottom + ((Rect3.Height - img.ScaledHeight) / 2);
114
            midP = MathSet.getMiddlePoint(new Point(x, y), new Point(x + img.ScaledWidth, y + img.ScaledHeight));
115
            System.Drawing.Drawing2D.Matrix mat2 = new System.Drawing.Drawing2D.Matrix();
116
            mat2.RotateAt((float)Angle * -1, new System.Drawing.PointF((float)midP.X, (float)midP.Y));
117
            contentByte.Transform(mat2);
118

  
119
            contentByte.AddImage(img);
120
            contentByte.RestoreState();
121
        }
84 122
        public static void sendReqLog(string name, string text)
85 123
        {
86 124
            try
FinalService/KCOM_FinalService/MarkupToPDF/MarkupToPDF.cs
1065 1065
                                                double Opacity = control.Opac;
1066 1066

  
1067 1067
                                                StringBuilder ApprovedImgPath = new StringBuilder(512);
1068
                                                GetPrivateProfileString("ApprovedImgPath", "URL", "(NONE)", ApprovedImgPath, 512, "C:\\ProgramData\\MARKUS\\settings.ini");
1068
                                                GetPrivateProfileString("ApprovedImgPath", "URL", "(NONE)", ApprovedImgPath, 512, "C:\\ProgramData\\MARKUS\\FinalService.ini");
1069 1069

  
1070 1070
                                                Controls_PDF.HoneyPDFLib_DrawSet_Symbol.DrawApproval(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Angle, Opacity, ApprovedImgPath.ToString());
1071 1071
                                            }
1072 1072
                                            break;
1073
                                        case "SymControl":
1074
                                            using (S_SymControl control = JsonSerializerHelper.JsonDeserialize<S_SymControl>(item))
1075
                                            {
1076
                                                Point StartPoint = GetPdfPointSystem(control.StartPoint);
1077
                                                Point EndPoint = GetPdfPointSystem(control.EndPoint);
1078
                                                List<Point> pointSet = GetPdfPointSystem(control.PointSet);
1079
                                                SolidColorBrush FontColor = _SetColor;
1080
                                                double Angle = control.Angle;
1081
                                                double Opacity = control.Opac;
1082

  
1083
                                                StringBuilder imgpath = new StringBuilder(512);
1084
                                                GetPrivateProfileString("CheckmarkImgPath", "URL", "(NONE)", imgpath, 512, "C:\\ProgramData\\MARKUS\\FinalService.ini");
1085

  
1086
                                                Controls_PDF.HoneyPDFLib_DrawSet_Symbol.DrawCheckMark(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Angle, Opacity, imgpath.ToString());
1087
                                            }
1088
                                            break;
1073 1089
                                        #endregion
1074 1090
                                        #region Image
1075 1091
                                        case "ImgControl":
......
1123 1139
                    //File.Move(FinalPDFPath.FullName, @"\\192.168.0.67\finalpdf\" + FinalPDFPath.Name.Replace(".tmp", ".pdf"));
1124 1140
                    //FinalPDFPath = new FileInfo(@"\\192.168.0.67\finalpdf\" + FinalPDFPath.Name.Replace(".tmp", ".pdf"));
1125 1141
                    StringBuilder PDFMovePath = new StringBuilder(255);
1126
                    GetPrivateProfileString("PDFMovePath", "URL", "(NONE)", PDFMovePath, 32, "C:\\ProgramData\\MARKUS\\settings.ini");
1142
                    GetPrivateProfileString("PDFMovePath", "URL", "(NONE)", PDFMovePath, 32, "C:\\ProgramData\\MARKUS\\FinalService.ini");
1127 1143
                    File.Move(FinalPDFPath.FullName, PDFMovePath.ToString() + FinalPDFPath.Name.Replace(".tmp", ".pdf"));
1128 1144
                    FinalPDFPath = new FileInfo(PDFMovePath.ToString() + FinalPDFPath.Name.Replace(".tmp", ".pdf"));
1129 1145

  

내보내기 Unified diff

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