|
@@ -1005,6 +1005,38 @@ namespace ComPDFKit.Tool
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private bool SaveStampImageData(CPDFAnnotation annotation,CRect stampRect)
|
|
|
|
+ {
|
|
|
|
+ CPDFStampAnnotation stampAnnot=annotation as CPDFStampAnnotation;
|
|
|
|
+ if(viewerTool==null || stampAnnot == null ||stampAnnot.GetStampType()!=C_STAMP_TYPE.IMAGE_STAMP)
|
|
|
|
+ {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ DefaultSettingParam defaultSettingParam = viewerTool.GetDefaultSettingParam();
|
|
|
|
+ StampParam stampParam = defaultSettingParam.StampParamDef;
|
|
|
|
+ byte[] imageData = null;
|
|
|
|
+ int imageWidth = 0;
|
|
|
|
+ int imageHeight = 0;
|
|
|
|
+ PDFHelp.ImageStreamToByte(stampParam.ImageStream, ref imageData, ref imageWidth, ref imageHeight);
|
|
|
|
+
|
|
|
|
+ if (imageData != null && imageWidth > 0 && imageHeight > 0)
|
|
|
|
+ {
|
|
|
|
+ stampAnnot.SetRect(stampRect);
|
|
|
|
+ stampAnnot.SetImageStamp(imageData,imageWidth,imageHeight,stampParam.Rotation);
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ catch (Exception ex)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
private void SaveCreateAnnotation(ref CPDFAnnotation annotation, ref MouseEventObject e)
|
|
private void SaveCreateAnnotation(ref CPDFAnnotation annotation, ref MouseEventObject e)
|
|
{
|
|
{
|
|
if (annotation == null)
|
|
if (annotation == null)
|
|
@@ -1218,7 +1250,10 @@ namespace ComPDFKit.Tool
|
|
stampRect.Width, stampRect.Height)
|
|
stampRect.Width, stampRect.Height)
|
|
);
|
|
);
|
|
CRect cStampRect = new CRect((float)PDFRect.Left, (float)PDFRect.Bottom, (float)PDFRect.Right, (float)PDFRect.Top);
|
|
CRect cStampRect = new CRect((float)PDFRect.Left, (float)PDFRect.Bottom, (float)PDFRect.Right, (float)PDFRect.Top);
|
|
- annotation.SetRect(cStampRect);
|
|
|
|
|
|
+ if (SaveStampImageData(annotation,cStampRect) == false)
|
|
|
|
+ {
|
|
|
|
+ annotation.SetRect(cStampRect);
|
|
|
|
+ }
|
|
annotation.UpdateAp();
|
|
annotation.UpdateAp();
|
|
e.IsCreate = true;
|
|
e.IsCreate = true;
|
|
e.annotType = C_ANNOTATION_TYPE.C_ANNOTATION_STAMP;
|
|
e.annotType = C_ANNOTATION_TYPE.C_ANNOTATION_STAMP;
|