Prechádzať zdrojové kódy

ComPDFKit.Tool(pdftech) - 修改图章复制粘贴保存

liyuxuan 8 mesiacov pred
rodič
commit
6f6c422755

+ 14 - 0
Demo/Examples/ComPDFKit.Tool/CPDFViewerTool.Command.cs

@@ -1376,7 +1376,21 @@ namespace ComPDFKit.Tool
 
                             CPDFAnnotation cPDFAnnotation = cPDFPage.CreateAnnot(item.CurrentType);
                             CreateDefaultAnnot(cPDFAnnotation, item.CurrentType, item);
+                      
                             cPDFAnnotation.SetRect(setRect);
+                            StampParam stampParam = item as StampParam;
+                            if (stampParam != null && stampParam.StampType == C_STAMP_TYPE.IMAGE_STAMP && stampParam.ImageStream != null)
+                            {
+                                byte[] imageData = null;
+                                int imageWidth = 0;
+                                int imageHeight = 0;
+                                PDFHelp.ImageStreamToByte(stampParam.ImageStream, ref imageData, ref imageWidth, ref imageHeight);
+                                CPDFStampAnnotation stampAnnot=cPDFAnnotation as CPDFStampAnnotation;
+                                if (stampAnnot!=null && imageData != null && imageWidth > 0 && imageHeight > 0)
+                                {
+                                    stampAnnot.SetImageStamp(imageData,imageWidth,imageHeight,stampParam.Rotation);
+                                }
+                            }
                             cPDFAnnotation.UpdateAp();
                             AnnotParam annotParam = ParamConverter.AnnotConverter(cPDFDocument, cPDFAnnotation);
                             (annotHistory as StampAnnotHistory).CurrentParam = (StampParam)annotParam;