12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352 |
- using ComPDFKit.PDFAnnotation.Form;
- using ComPDFKit.PDFAnnotation;
- using ComPDFKit.PDFDocument.Action;
- using ComPDFKit.PDFDocument;
- using ComPDFKit.Tool.SettingParam;
- using ComPDFKitViewer;
- using static ComPDFKit.PDFAnnotation.CTextAttribute.CFontNameHelper;
- using static ComPDFKit.PDFAnnotation.CTextAttribute;
- using ComPDFKit.Tool.Help;
- using static ComPDFKit.Tool.Help.ParamConverter;
- using ComPDFKit.Import;
- using ComPDFKit.Measure;
- namespace ComPDFKit.Tool
- {
- public partial class CPDFViewerTool
- {
- public CPDFViewer GetCPDFViewer()
- {
- return PDFViewer;
- }
- #region DefaultAnnot
- public void CreateDefaultAnnot(CPDFAnnotation cPDFAnnotation, C_ANNOTATION_TYPE annotType, AnnotParam annotParam)
- {
- switch (annotType)
- {
- case C_ANNOTATION_TYPE.C_ANNOTATION_NONE:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_UNKOWN:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_TEXT:
- DefaultTextAnnot(cPDFAnnotation, annotParam);
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_LINK:
- DefaultLinkAnnot(cPDFAnnotation, annotParam);
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_FREETEXT:
- DefaultFreeTextAnnot(cPDFAnnotation, annotParam);
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_LINE:
- if (annotParam != null)
- {
- if (annotParam is LineMeasureParam)
- {
- DefaultLineMeasureAnnot(cPDFAnnotation, annotParam);
- }
- else
- {
- DefaultLineAnnot(cPDFAnnotation, annotParam);
- }
- }
- else
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- if (defaultSettingParam.IsOpenMeasure)
- {
- DefaultLineMeasureAnnot(cPDFAnnotation, annotParam);
- }
- else
- {
- DefaultLineAnnot(cPDFAnnotation, annotParam);
- }
- }
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_SQUARE:
- DefaultSquareAnnot(cPDFAnnotation, annotParam);
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_CIRCLE:
- DefaultCircleAnnot(cPDFAnnotation, annotParam);
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_POLYGON:
- DefaultPolygonMeasureAnnot(cPDFAnnotation, annotParam);
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_POLYLINE:
- DefaultPolyLineMeasureAnnot(cPDFAnnotation, annotParam);
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_HIGHLIGHT:
- DefaultHighlightAnnot(cPDFAnnotation, annotParam);
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_UNDERLINE:
- DefaultUnderlineAnnot(cPDFAnnotation, annotParam);
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_SQUIGGLY:
- DefaultSquigglyAnnot(cPDFAnnotation, annotParam);
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_STRIKEOUT:
- DefaultStrikeoutAnnot(cPDFAnnotation, annotParam);
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_STAMP:
- DefaultStampAnnot(cPDFAnnotation, annotParam);
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_CARET:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_INK:
- DefaultInkAnnot(cPDFAnnotation, annotParam);
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_POPUP:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_FILEATTACHMENT:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_SOUND:
- DefaultSoundAnnot(cPDFAnnotation, annotParam);
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_MOVIE:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_WIDGET:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_SCREEN:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_PRINTERMARK:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_TRAPNET:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_WATERMARK:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_3D:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_RICHMEDIA:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_REDACT:
- DefaultRedactAnnot(cPDFAnnotation, annotParam);
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_INTERCHANGE:
- break;
- default:
- break;
- }
- }
- private void DefaultAnnot(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- if (cPDFAnnotation == null || annotParam == null)
- {
- return;
- }
- if (!string.IsNullOrEmpty(annotParam.Content))
- {
- cPDFAnnotation.SetContent(annotParam.Content);
- }
- if (!string.IsNullOrEmpty(annotParam.Author))
- {
- cPDFAnnotation.SetAuthor(annotParam.Author);
- }
- if (!string.IsNullOrEmpty(annotParam.CreateTime))
- {
- cPDFAnnotation.SetCreationDate(annotParam.CreateTime);
- }
- if (!string.IsNullOrEmpty(annotParam.UpdateTime))
- {
- cPDFAnnotation.SetModifyDate(annotParam.UpdateTime);
- }
- cPDFAnnotation.SetIsLocked(annotParam.Locked);
- cPDFAnnotation.SetTransparency(annotParam.Transparency);
- }
- private void DefaultTextAnnot(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- CPDFTextAnnotation TextAnnotation = (cPDFAnnotation as CPDFTextAnnotation);
- if (TextAnnotation == null)
- {
- return;
- }
- StickyNoteParam StickyNoteParamDef;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- StickyNoteParamDef = defaultSettingParam.StickyNoteParamDef;
- }
- else
- {
- StickyNoteParamDef = annotParam as StickyNoteParam;
- }
- TextAnnotation.SetColor(StickyNoteParamDef.StickyNoteColor);
- if (string.IsNullOrEmpty(StickyNoteParamDef.IconName) == false)
- {
- TextAnnotation.SetIconName(StickyNoteParamDef.IconName);
- }
- DefaultAnnot(cPDFAnnotation, StickyNoteParamDef);
- }
- private void DefaultLinkAnnot(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- CPDFLinkAnnotation linkAnnotation = (cPDFAnnotation as CPDFLinkAnnotation);
- if (linkAnnotation == null)
- {
- return;
- }
- LinkParam linkParam;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- linkParam = defaultSettingParam.LinkParamDef;
- }
- else
- {
- linkParam = annotParam as LinkParam;
- }
- switch (linkParam.Action)
- {
- case C_ACTION_TYPE.ACTION_TYPE_GOTO:
- CPDFGoToAction gotoAction = new CPDFGoToAction();
- CPDFDestination destination = new CPDFDestination();
- destination.Position_X = linkParam.DestinationPosition.x;
- destination.Position_Y = linkParam.DestinationPosition.y;
- destination.PageIndex = linkParam.DestinationPageIndex;
- gotoAction.SetDestination(PDFViewer.GetDocument(), destination);
- linkAnnotation.SetLinkAction(gotoAction);
- break;
- case C_ACTION_TYPE.ACTION_TYPE_URI:
- CPDFUriAction uriAction = new CPDFUriAction();
- if (!string.IsNullOrEmpty(linkParam.Uri))
- {
- uriAction.SetUri(linkParam.Uri);
- }
- linkAnnotation.SetLinkAction(uriAction);
- break;
- default:
- break;
- }
- DefaultAnnot(cPDFAnnotation, linkParam);
- }
- private void DefaultFreeTextAnnot(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- CPDFFreeTextAnnotation freeTextAnnotation = (cPDFAnnotation as CPDFFreeTextAnnotation);
- if (freeTextAnnotation == null)
- {
- return;
- }
- FreeTextParam FreeTextParam;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- FreeTextParam = defaultSettingParam.FreeTextParamDef;
- }
- else
- {
- FreeTextParam = annotParam as FreeTextParam;
- }
- freeTextAnnotation.SetFreetextAlignment((C_TEXT_ALIGNMENT)(int)FreeTextParam.Alignment);
- if (FreeTextParam.LineColor != null)
- {
- freeTextAnnotation.SetLineColor(FreeTextParam.LineColor);
- }
- freeTextAnnotation.SetTransparency(FreeTextParam.Transparency);
- freeTextAnnotation.SetLineWidth((float)FreeTextParam.LineWidth);
- if (FreeTextParam.HasBgColor && freeTextAnnotation.BgColor.Length == 3)
- {
- freeTextAnnotation.SetBgColor(FreeTextParam.BgColor);
- }
- if (FreeTextParam.Dash != null && FreeTextParam.Dash.Length > 0)
- {
- //补充保存虚线样式
- freeTextAnnotation.SetBorderStyle(C_BORDER_STYLE.BS_DASHDED, FreeTextParam.Dash);
- }
- CTextAttribute textAttr = new CTextAttribute();
- textAttr.FontColor = FreeTextParam.FontColor;
- textAttr.FontSize = (float)FreeTextParam.FontSize;
- textAttr.FontName = FreeTextParam.FontName;
- freeTextAnnotation.SetFreetextDa(textAttr);
- DefaultAnnot(cPDFAnnotation, FreeTextParam);
- }
- private void DefaultLineAnnot(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- CPDFLineAnnotation LineAnnotation = (cPDFAnnotation as CPDFLineAnnotation);
- if (LineAnnotation == null)
- {
- return;
- }
- LineParam lineParam;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- lineParam = defaultSettingParam.LineParamDef;
- }
- else
- {
- lineParam = annotParam as LineParam;
- }
- if (lineParam.LineColor != null)
- {
- LineAnnotation.SetLineColor(lineParam.LineColor);
- }
- if (lineParam.HasBgColor)
- {
- if (lineParam.BgColor != null)
- {
- LineAnnotation.SetBgColor(lineParam.BgColor);
- }
- }
- else
- {
- LineAnnotation.ClearBgColor();
- }
- LineAnnotation.SetLineWidth((float)lineParam.LineWidth);
- LineAnnotation.SetTransparency(lineParam.Transparency);
- if (lineParam.LineDash != null)
- {
- LineAnnotation.SetBorderStyle(lineParam.BorderStyle, lineParam.LineDash);
- }
- LineAnnotation.SetLineType(lineParam.HeadLineType, lineParam.TailLineType);
- DefaultAnnot(cPDFAnnotation, lineParam);
- }
- private void DefaultSquareAnnot(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- CPDFSquareAnnotation SquareAnnotation = (cPDFAnnotation as CPDFSquareAnnotation);
- if (SquareAnnotation == null)
- {
- return;
- }
- SquareParam squareParam;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- squareParam = defaultSettingParam.SquareParamDef;
- }
- else
- {
- squareParam = annotParam as SquareParam;
- }
- if (squareParam.LineColor != null)
- {
- SquareAnnotation.SetLineColor(squareParam.LineColor);
- }
- if (squareParam.HasBgColor)
- {
- if (squareParam.BgColor != null)
- {
- SquareAnnotation.SetBgColor(squareParam.BgColor);
- }
- }
- else
- {
- SquareAnnotation.ClearBgColor();
- }
- SquareAnnotation.SetLineWidth((float)squareParam.LineWidth);
- SquareAnnotation.SetTransparency(squareParam.Transparency);
- if (squareParam.LineDash != null)
- {
- SquareAnnotation.SetBorderStyle(squareParam.BorderStyle, squareParam.LineDash);
- }
- DefaultAnnot(cPDFAnnotation, squareParam);
- }
- private void DefaultCircleAnnot(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- CPDFCircleAnnotation circleAnnotation = (cPDFAnnotation as CPDFCircleAnnotation);
- if (circleAnnotation == null)
- {
- return;
- }
- CircleParam circleParam;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- circleParam = defaultSettingParam.CircleParamDef;
- }
- else
- {
- circleParam = annotParam as CircleParam;
- }
- if (circleParam.LineColor != null)
- {
- circleAnnotation.SetLineColor(circleParam.LineColor);
- }
- if (circleParam.HasBgColor)
- {
- if (circleParam.BgColor != null)
- {
- circleAnnotation.SetBgColor(circleParam.BgColor);
- }
- }
- else
- {
- circleAnnotation.ClearBgColor();
- }
- circleAnnotation.SetLineWidth((float)circleParam.LineWidth);
- circleAnnotation.SetTransparency(circleParam.Transparency);
- if (circleParam.LineDash != null)
- {
- circleAnnotation.SetBorderStyle(circleParam.BorderStyle, circleParam.LineDash);
- }
- DefaultAnnot(cPDFAnnotation, circleParam);
- }
- private void DefaultHighlightAnnot(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- CPDFHighlightAnnotation highlightAnnotation = (cPDFAnnotation as CPDFHighlightAnnotation);
- if (highlightAnnotation == null)
- {
- return;
- }
- HighlightParam highlightParam;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- highlightParam = defaultSettingParam.HighlightParamDef;
- }
- else
- {
- highlightParam = annotParam as HighlightParam;
- }
- if (highlightParam.HighlightColor != null)
- {
- highlightAnnotation.SetColor(highlightParam.HighlightColor);
- }
- DefaultAnnot(cPDFAnnotation, highlightParam);
- }
- private void DefaultUnderlineAnnot(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- CPDFUnderlineAnnotation highlightAnnotation = (cPDFAnnotation as CPDFUnderlineAnnotation);
- if (highlightAnnotation == null)
- {
- return;
- }
- UnderlineParam underlineParam;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- underlineParam = defaultSettingParam.UnderlineParamDef;
- }
- else
- {
- underlineParam = annotParam as UnderlineParam;
- }
- if (underlineParam.UnderlineColor != null)
- {
- highlightAnnotation.SetColor(underlineParam.UnderlineColor);
- }
- DefaultAnnot(cPDFAnnotation, underlineParam);
- }
- private void DefaultSquigglyAnnot(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- CPDFSquigglyAnnotation squigglyAnnotation = (cPDFAnnotation as CPDFSquigglyAnnotation);
- if (squigglyAnnotation == null)
- {
- return;
- }
- SquigglyParam squigglyParam;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- squigglyParam = defaultSettingParam.SquigglyParamDef;
- }
- else
- {
- squigglyParam = annotParam as SquigglyParam;
- }
- if (squigglyParam.SquigglyColor != null)
- {
- squigglyAnnotation.SetColor(squigglyParam.SquigglyColor);
- }
- DefaultAnnot(cPDFAnnotation, squigglyParam);
- }
- private void DefaultStrikeoutAnnot(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- CPDFStrikeoutAnnotation strikeoutAnnotation = (cPDFAnnotation as CPDFStrikeoutAnnotation);
- if (strikeoutAnnotation == null)
- {
- return;
- }
- StrikeoutParam strikeoutParam;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- strikeoutParam = defaultSettingParam.StrikeoutParamDef;
- }
- else
- {
- strikeoutParam = annotParam as StrikeoutParam;
- }
- if (strikeoutParam.StrikeoutColor != null)
- {
- strikeoutAnnotation.SetColor(strikeoutParam.StrikeoutColor);
- }
- DefaultAnnot(cPDFAnnotation, strikeoutParam);
- }
- private void DefaultStampAnnot(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- CPDFStampAnnotation stampAnnot = (cPDFAnnotation as CPDFStampAnnotation);
- if (stampAnnot == null)
- {
- return;
- }
- StampParam stampParam;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- stampParam = defaultSettingParam.StampParamDef;
- }
- else
- {
- stampParam = annotParam as StampParam;
- }
- switch (stampParam.StampType)
- {
- case C_STAMP_TYPE.STANDARD_STAMP:
- {
- string stampText = stampParam.StampText;
- if (stampText == null)
- {
- stampText = string.Empty;
- }
- stampAnnot.SetStandardStamp(stampText, stampParam.PageRotation);
- }
- break;
- case C_STAMP_TYPE.IMAGE_STAMP:
- {
- 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(new CRect(0, imageHeight, imageWidth, 0));
- stampAnnot.SetImageStamp(
- imageData,
- imageWidth,
- imageHeight,
- stampParam.PageRotation);
- }
- }
- break;
- case C_STAMP_TYPE.TEXT_STAMP:
- {
- string dateText = stampParam.DateText;
- string stampText = stampParam.StampText;
- if (dateText == null)
- {
- dateText = string.Empty;
- }
- if (stampText == null)
- {
- stampText = string.Empty;
- }
- stampAnnot.SetTextStamp(
- stampText,
- dateText,
- stampParam.TextStampShape,
- stampParam.TextStampColor,
- stampParam.PageRotation);
- }
- break;
- default:
- break;
- }
- stampAnnot.AnnotationRotator.SetRotation(stampParam.Rotation);
- DefaultAnnot(cPDFAnnotation, stampParam);
- }
- private void DefaultInkAnnot(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- CPDFInkAnnotation InkAnnotation = (cPDFAnnotation as CPDFInkAnnotation);
- if (InkAnnotation == null)
- {
- return;
- }
- InkParam inkParam;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- inkParam = defaultSettingParam.InkParamDef;
- }
- else
- {
- inkParam = annotParam as InkParam;
- }
- if (inkParam.InkColor != null)
- {
- InkAnnotation.SetInkColor(inkParam.InkColor);
- }
- InkAnnotation.SetThickness((float)inkParam.Thickness);
- CPDFInkAnnotation inkAnnot = cPDFAnnotation as CPDFInkAnnotation;
- inkAnnot.SetInkPath(inkParam.InkPath);
- if (inkParam.Dash != null && inkParam.Dash.Length > 0)
- {
- inkAnnot.SetBorderStyle(C_BORDER_STYLE.BS_DASHDED, inkParam.Dash);
- }
- else
- {
- inkAnnot.SetBorderStyle(C_BORDER_STYLE.BS_SOLID, new float[0]);
- }
- DefaultAnnot(cPDFAnnotation, inkParam);
- }
- private void DefaultSoundAnnot(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- CPDFSoundAnnotation SoundAnnotation = (cPDFAnnotation as CPDFSoundAnnotation);
- if (SoundAnnotation == null)
- {
- return;
- }
- SoundParam soundParam;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- soundParam = defaultSettingParam.SoundParamDef;
- }
- else
- {
- soundParam = annotParam as SoundParam;
- }
- byte[] imageData = null;
- int imageWidth = 0;
- int imageHeight = 0;
- PDFHelp.ImageStreamToByte(soundParam.ImageStream, ref imageData, ref imageWidth, ref imageHeight);
- if (imageData != null && imageWidth > 0 && imageHeight > 0)
- {
- SoundAnnotation.SetRect(new Import.CRect(0, imageHeight, imageWidth, 0));
- SoundAnnotation.SetSoundPath(
- imageData,
- imageWidth,
- imageHeight,
- soundParam.SoundFilePath);
- }
- DefaultAnnot(cPDFAnnotation, soundParam);
- }
- private void DefaultRedactAnnot(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- CPDFRedactAnnotation redactAnnotation = (cPDFAnnotation as CPDFRedactAnnotation);
- if (redactAnnotation == null)
- {
- return;
- }
- RedactParam redactParam;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- redactParam = defaultSettingParam.RedactParamDef;
- }
- else
- {
- redactParam = annotParam as RedactParam;
- }
- if (redactParam.LineColor != null)
- {
- redactAnnotation.SetOutlineColor(redactParam.LineColor);
- }
- if (redactParam.BgColor != null)
- {
- redactAnnotation.SetFillColor(redactParam.BgColor);
- }
- redactAnnotation.SetTextAlignment(redactParam.Alignment);
- if (!string.IsNullOrEmpty(redactParam.OverlayText))
- {
- redactAnnotation.SetOverlayText(redactParam.OverlayText);
- }
- CTextAttribute textAttr = new CTextAttribute();
- byte[] fontColor = new byte[3];
- if (redactParam.FontColor != null && redactParam.FontColor.Length == 3)
- {
- fontColor = redactParam.FontColor;
- }
- textAttr.FontColor = fontColor;
- textAttr.FontSize = (float)redactParam.FontSize;
- textAttr.FontName = redactParam.FontName;
- redactAnnotation.SetTextAttribute(textAttr);
- DefaultAnnot(cPDFAnnotation, redactParam);
- }
- private void DefaultLineMeasureAnnot(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- CPDFLineAnnotation LineAnnotation = (cPDFAnnotation as CPDFLineAnnotation);
- if (LineAnnotation == null)
- {
- return;
- }
- if (!LineAnnotation.IsMeasured() && annotParam != null)
- {
- return;
- }
- LineMeasureParam lineMeasureParam;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- lineMeasureParam = defaultSettingParam.LineMeasureParamDef;
- }
- else
- {
- lineMeasureParam = annotParam as LineMeasureParam;
- }
- if (lineMeasureParam.LineColor != null)
- {
- LineAnnotation.SetLineColor(lineMeasureParam.LineColor);
- }
- LineAnnotation.SetLineWidth((float)lineMeasureParam.LineWidth);
- if (lineMeasureParam.LineDash != null)
- {
- if (lineMeasureParam.LineDash.Length == 0)
- {
- LineAnnotation.SetBorderStyle(C_BORDER_STYLE.BS_SOLID, new float[0]);
- }
- else
- {
- LineAnnotation.SetBorderStyle(C_BORDER_STYLE.BS_DASHDED, lineMeasureParam.LineDash);
- }
- }
- LineAnnotation.SetLineType(lineMeasureParam.HeadLineType, lineMeasureParam.TailLineType);
- CTextAttribute textAttribute = new CTextAttribute();
- textAttribute.FontColor = lineMeasureParam.FontColor;
- textAttribute.FontSize = (float)lineMeasureParam.FontSize;
- textAttribute.FontName = CFontNameHelper.ObtainFontName(CFontNameHelper.GetFontType(lineMeasureParam.FontName),
- lineMeasureParam.IsBold,
- lineMeasureParam.IsItalic);
- LineAnnotation.SetTextAttribute(textAttribute);
- if (lineMeasureParam.measureInfo != null)
- {
- CPDFDistanceMeasure polygonMeasure = LineAnnotation.GetDistanceMeasure();
- if (polygonMeasure != null)
- {
- polygonMeasure.SetMeasureInfo(lineMeasureParam.measureInfo);
- polygonMeasure.SetMeasureScale(lineMeasureParam.measureInfo.RulerBase, lineMeasureParam.measureInfo.RulerBaseUnit,
- lineMeasureParam.measureInfo.RulerTranslate, lineMeasureParam.measureInfo.RulerTranslateUnit);
- var x = polygonMeasure.UpdateAnnotMeasure();
- }
- }
- DefaultAnnot(cPDFAnnotation, lineMeasureParam);
- }
- private void DefaultPolygonMeasureAnnot(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- CPDFPolygonAnnotation PolyAnnotation = (cPDFAnnotation as CPDFPolygonAnnotation);
- bool IsOpenMeasure = true;
- if (PolyAnnotation == null)
- {
- return;
- }
- if (annotParam != null)
- {
- return;
- }
- PolygonMeasureParam MeasureParam;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- MeasureParam = defaultSettingParam.PolygonMeasureParamDef;
- IsOpenMeasure = defaultSettingParam.IsOpenMeasure;
- }
- else
- {
- MeasureParam = annotParam as PolygonMeasureParam;
- IsOpenMeasure = defaultSettingParam.IsOpenMeasure;
- }
- if (MeasureParam.LineColor != null)
- {
- PolyAnnotation.SetLineColor(MeasureParam.LineColor);
- }
- PolyAnnotation.SetLineWidth((float)MeasureParam.LineWidth);
- if (MeasureParam.LineDash != null)
- {
- if (MeasureParam.LineDash.Length == 0)
- {
- PolyAnnotation.SetBorderStyle(C_BORDER_STYLE.BS_SOLID, new float[0]);
- }
- else
- {
- PolyAnnotation.SetBorderStyle(C_BORDER_STYLE.BS_DASHDED, MeasureParam.LineDash);
- }
- }
- if (MeasureParam.HasFillColor && MeasureParam.FillColor != null && MeasureParam.FillColor.Length == 3)
- {
- PolyAnnotation.SetBgColor(MeasureParam.FillColor);
- }
- if(MeasureParam.BorderEffector != null)
- {
- PolyAnnotation.SetAnnotBorderEffector(MeasureParam.BorderEffector);
- }
- if (IsOpenMeasure)
- {
- CTextAttribute textAttribute = new CTextAttribute();
- textAttribute.FontColor = MeasureParam.FontColor;
- textAttribute.FontSize = (float)MeasureParam.FontSize;
- textAttribute.FontName = CFontNameHelper.ObtainFontName(CFontNameHelper.GetFontType(MeasureParam.FontName),
- MeasureParam.IsBold,
- MeasureParam.IsItalic);
- PolyAnnotation.SetTextAttribute(textAttribute);
- if (MeasureParam.measureInfo != null)
- {
- CPDFAreaMeasure polygonMeasure = PolyAnnotation.GetAreaMeasure();
- if (polygonMeasure != null)
- {
- polygonMeasure.SetMeasureInfo(MeasureParam.measureInfo);
- polygonMeasure.SetMeasureScale(MeasureParam.measureInfo.RulerBase, MeasureParam.measureInfo.RulerBaseUnit,
- MeasureParam.measureInfo.RulerTranslate, MeasureParam.measureInfo.RulerTranslateUnit);
- polygonMeasure.UpdateAnnotMeasure();
- }
- }
- cPDFAnnotation.UpdateAp();
- }
-
- DefaultAnnot(cPDFAnnotation, MeasureParam);
- }
- private void DefaultPolyLineMeasureAnnot(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- CPDFPolylineAnnotation PolyAnnotation = (cPDFAnnotation as CPDFPolylineAnnotation);
- if (PolyAnnotation == null)
- {
- return;
- }
- if (!PolyAnnotation.IsMeasured() && annotParam != null)
- {
- return;
- }
- PolyLineMeasureParam lineMeasureParam;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- lineMeasureParam = defaultSettingParam.PolyLineMeasureParamDef;
- }
- else
- {
- lineMeasureParam = annotParam as PolyLineMeasureParam;
- }
- if (lineMeasureParam.LineColor != null)
- {
- PolyAnnotation.SetLineColor(lineMeasureParam.LineColor);
- }
- PolyAnnotation.SetLineWidth((float)lineMeasureParam.LineWidth);
- if (lineMeasureParam.LineDash != null)
- {
- if (lineMeasureParam.LineDash.Length == 0)
- {
- PolyAnnotation.SetBorderStyle(C_BORDER_STYLE.BS_SOLID, new float[0]);
- }
- else
- {
- PolyAnnotation.SetBorderStyle(C_BORDER_STYLE.BS_DASHDED, lineMeasureParam.LineDash);
- }
- }
- CTextAttribute textAttribute = new CTextAttribute();
- textAttribute.FontColor = lineMeasureParam.FontColor;
- textAttribute.FontSize = (float)lineMeasureParam.FontSize;
- textAttribute.FontName = CFontNameHelper.ObtainFontName(CFontNameHelper.GetFontType(lineMeasureParam.FontName),
- lineMeasureParam.IsBold,
- lineMeasureParam.IsItalic);
- PolyAnnotation.SetTextAttribute(textAttribute);
- if (lineMeasureParam.measureInfo != null)
- {
- CPDFPerimeterMeasure polygonMeasure = PolyAnnotation.GetPerimeterMeasure();
- if (polygonMeasure != null)
- {
- polygonMeasure.SetMeasureInfo(lineMeasureParam.measureInfo);
- polygonMeasure.SetMeasureScale(lineMeasureParam.measureInfo.RulerBase, lineMeasureParam.measureInfo.RulerBaseUnit,
- lineMeasureParam.measureInfo.RulerTranslate, lineMeasureParam.measureInfo.RulerTranslateUnit);
- polygonMeasure.UpdateAnnotMeasure();
- }
- }
- DefaultAnnot(cPDFAnnotation, lineMeasureParam);
- }
- #endregion
- #region DefaultWidget
- public void CreateDefaultWidget(CPDFAnnotation cPDFAnnotation, C_WIDGET_TYPE annotType, AnnotParam annotParam)
- {
- switch (annotType)
- {
- case C_WIDGET_TYPE.WIDGET_PUSHBUTTON:
- DefaultPushButton(cPDFAnnotation, annotParam);
- break;
- case C_WIDGET_TYPE.WIDGET_CHECKBOX:
- DefaultCheckBox(cPDFAnnotation, annotParam);
- break;
- case C_WIDGET_TYPE.WIDGET_RADIOBUTTON:
- DefaultRadioButton(cPDFAnnotation, annotParam);
- break;
- case C_WIDGET_TYPE.WIDGET_TEXTFIELD:
- DefaultTextField(cPDFAnnotation, annotParam);
- break;
- case C_WIDGET_TYPE.WIDGET_COMBOBOX:
- DefaultComBoBox(cPDFAnnotation, annotParam);
- break;
- case C_WIDGET_TYPE.WIDGET_LISTBOX:
- DefaultListBox(cPDFAnnotation, annotParam);
- break;
- case C_WIDGET_TYPE.WIDGET_SIGNATUREFIELDS:
- DefaultSignatureFields(cPDFAnnotation, annotParam);
- break;
- case C_WIDGET_TYPE.WIDGET_UNKNOWN:
- break;
- default:
- break;
- }
- }
- private void DefaultWidget(CPDFWidget cPDFWidget, WidgetParm widgetParm)
- {
- if (cPDFWidget == null || widgetParm == null)
- {
- return;
- }
- cPDFWidget.SetWidgetBorderStyle(widgetParm.BorderStyle);
- if (widgetParm.HasLineColor)
- {
- if (widgetParm.LineColor != null)
- {
- cPDFWidget.SetWidgetBorderRGBColor(widgetParm.LineColor);
- }
- }
- else
- {
- cPDFWidget.ClearWidgetBorderRGBColor();
- }
- if (widgetParm.HasBgColor)
- {
- if (widgetParm.BgColor != null)
- {
- cPDFWidget.SetWidgetBgRGBColor(widgetParm.BgColor);
- }
- }
- else
- {
- cPDFWidget.ClearWidgetBgRGBColor();
- }
- cPDFWidget.SetBorderWidth((float)widgetParm.LineWidth);
- cPDFWidget.SetFlags(GetFormFlags(FormField.Visible, cPDFWidget));
- cPDFWidget.SetIsReadOnly(widgetParm.IsReadOnly);
- cPDFWidget.SetIsHidden(widgetParm.IsHidden);
- DefaultAnnot(cPDFWidget, widgetParm);
- }
- private void DefaultPushButton(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- CPDFPushButtonWidget widget = (cPDFAnnotation as CPDFPushButtonWidget);
- if (widget == null)
- {
- return;
- }
- PushButtonParam pushButtonParam;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- pushButtonParam = defaultSettingParam.PushButtonParamDef;
- }
- else
- {
- pushButtonParam = annotParam as PushButtonParam;
- }
- CTextAttribute textAttr = new CTextAttribute();
- textAttr.FontColor = pushButtonParam.FontColor;
- textAttr.FontSize = (float)pushButtonParam.FontSize;
- textAttr.FontName = pushButtonParam.FontName;
- widget.SetTextAttribute(textAttr);
- if (!string.IsNullOrEmpty(pushButtonParam.FieldName))
- {
- widget.SetFieldName(pushButtonParam.FieldName);
- }
- else
- {
- widget.SetFieldName(string.Format("PushButton{0}", widget.Page.GetAnnotCount()));
- }
- if (!string.IsNullOrEmpty(pushButtonParam.Text))
- {
- widget.SetButtonTitle(pushButtonParam.Text);
- }
- switch (pushButtonParam.Action)
- {
- case C_ACTION_TYPE.ACTION_TYPE_GOTO:
- CPDFGoToAction gotoAction = new CPDFGoToAction();
- CPDFDestination destination = new CPDFDestination();
- destination.Position_X = pushButtonParam.DestinationPosition.x;
- destination.Position_Y = pushButtonParam.DestinationPosition.y;
- destination.PageIndex = pushButtonParam.DestinationPageIndex;
- gotoAction.SetDestination(PDFViewer.GetDocument(), destination);
- widget.SetButtonAction(gotoAction);
- break;
- case C_ACTION_TYPE.ACTION_TYPE_URI:
- CPDFUriAction uriAction = new CPDFUriAction();
- if (!string.IsNullOrEmpty(pushButtonParam.Uri))
- {
- uriAction.SetUri(pushButtonParam.Uri);
- }
- widget.SetButtonAction(uriAction);
- break;
- default:
- break;
- }
- DefaultWidget(widget, pushButtonParam);
- }
- private void DefaultCheckBox(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- CPDFCheckBoxWidget widget = (cPDFAnnotation as CPDFCheckBoxWidget);
- if (widget == null)
- {
- return;
- }
- CheckBoxParam checkBoxParam;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- checkBoxParam = defaultSettingParam.CheckBoxParamDef;
- }
- else
- {
- checkBoxParam = annotParam as CheckBoxParam;
- }
- CTextAttribute textAttr = widget.GetTextAttribute();
- textAttr.FontColor = checkBoxParam.FontColor;
- textAttr.FontSize = (float)checkBoxParam.FontSize;
- bool isBold = IsBold(textAttr.FontName);
- bool isItalic = IsItalic(textAttr.FontName);
- FontType checkFontType = CFontNameHelper.GetFontType(checkBoxParam.FontName);
- textAttr.FontName = CFontNameHelper.ObtainFontName(
- checkFontType == FontType.Unknown ? FontType.Helvetica : checkFontType,
- isBold,
- isItalic);
- widget.SetTextAttribute(textAttr);
- if (!string.IsNullOrEmpty(checkBoxParam.FieldName))
- {
- widget.SetFieldName(checkBoxParam.FieldName);
- }
- else
- {
- widget.SetFieldName(string.Format("CheckBox{0}", widget.Page.GetAnnotCount()));
- }
- widget.SetWidgetCheckStyle(checkBoxParam.CheckStyle);
- widget.SetChecked(checkBoxParam.IsChecked);
- DefaultWidget(widget, checkBoxParam);
- }
- private void DefaultRadioButton(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- CPDFRadioButtonWidget widget = (cPDFAnnotation as CPDFRadioButtonWidget);
- if (widget == null)
- {
- return;
- }
- RadioButtonParam radioButtonParam;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- radioButtonParam = defaultSettingParam.RadioButtonParamDef;
- }
- else
- {
- radioButtonParam = annotParam as RadioButtonParam;
- }
- CTextAttribute textAttr = widget.GetTextAttribute();
- textAttr.FontColor = radioButtonParam.FontColor;
- textAttr.FontSize = (float)radioButtonParam.FontSize;
- bool isBold = IsBold(textAttr.FontName);
- bool isItalic = IsItalic(textAttr.FontName);
- FontType checkFontType = CFontNameHelper.GetFontType(radioButtonParam.FontName);
- textAttr.FontName = CFontNameHelper.ObtainFontName(
- checkFontType == FontType.Unknown ? FontType.Helvetica : checkFontType,
- isBold,
- isItalic);
- widget.SetTextAttribute(textAttr);
- if (!string.IsNullOrEmpty(radioButtonParam.FieldName))
- {
- widget.SetFieldName(radioButtonParam.FieldName);
- }
- else
- {
- widget.SetFieldName("RadioGroup1");
- }
- widget.SetWidgetCheckStyle(radioButtonParam.CheckStyle);
- widget.SetChecked(radioButtonParam.IsChecked);
- DefaultWidget(widget, radioButtonParam);
- }
- private void DefaultTextField(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- CPDFTextWidget widget = (cPDFAnnotation as CPDFTextWidget);
- if (widget == null)
- {
- return;
- }
- TextBoxParam textBoxParam;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- textBoxParam = defaultSettingParam.TextBoxParamDef;
- }
- else
- {
- textBoxParam = annotParam as TextBoxParam;
- }
- CTextAttribute textAttr = new CTextAttribute();
- textAttr.FontColor = textBoxParam.FontColor;
- textAttr.FontSize = (float)textBoxParam.FontSize;
- textAttr.FontName = textBoxParam.FontName;
- widget.SetTextAttribute(textAttr);
- if (!string.IsNullOrEmpty(textBoxParam.FieldName))
- {
- widget.SetFieldName(textBoxParam.FieldName);
- }
- else
- {
- widget.SetFieldName(string.Format("TextField{0}", widget.Page.GetAnnotCount()));
- }
- widget.SetMultiLine(textBoxParam.IsMultiLine);
- widget.SetJustification(textBoxParam.Alignment);
- if (string.IsNullOrEmpty(textBoxParam.Text) == false)
- {
- widget.SetText(textBoxParam.Text);
- }
- DefaultWidget(widget, textBoxParam);
- }
- private void DefaultComBoBox(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- CPDFComboBoxWidget widget = (cPDFAnnotation as CPDFComboBoxWidget);
- if (widget == null)
- {
- return;
- }
- ComboBoxParam comboBoxParam;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- comboBoxParam = defaultSettingParam.ComboBoxParamDef;
- }
- else
- {
- comboBoxParam = annotParam as ComboBoxParam;
- }
- CTextAttribute textAttr = new CTextAttribute();
- textAttr.FontColor = comboBoxParam.FontColor;
- textAttr.FontSize = (float)comboBoxParam.FontSize;
- textAttr.FontName = comboBoxParam.FontName;
- widget.SetTextAttribute(textAttr);
- if (!string.IsNullOrEmpty(comboBoxParam.FieldName))
- {
- widget.SetFieldName(comboBoxParam.FieldName);
- }
- else
- {
- widget.SetFieldName(string.Format("ComBoBox{0}", widget.Page.GetAnnotCount()));
- }
- if (comboBoxParam.OptionItems != null && comboBoxParam.OptionItems.Count > 0)
- {
- int addIndex = 0;
- foreach (string key in comboBoxParam.OptionItems.Keys)
- {
- widget.AddOptionItem(addIndex, comboBoxParam.OptionItems[key], key);
- addIndex++;
- }
- }
- if (comboBoxParam.SelectItemsIndex != null && comboBoxParam.SelectItemsIndex.Count > 0)
- {
- widget.SelectItem(comboBoxParam.SelectItemsIndex[0]);
- }
- DefaultWidget(widget, comboBoxParam);
- }
- private void DefaultListBox(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- CPDFListBoxWidget widget = (cPDFAnnotation as CPDFListBoxWidget);
- if (widget == null)
- {
- return;
- }
- ListBoxParam listBoxParam;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- listBoxParam = defaultSettingParam.ListBoxParamDef;
- }
- else
- {
- listBoxParam = annotParam as ListBoxParam;
- }
- CTextAttribute textAttr = new CTextAttribute();
- textAttr.FontColor = listBoxParam.FontColor;
- textAttr.FontSize = (float)listBoxParam.FontSize;
- textAttr.FontName = listBoxParam.FontName;
- widget.SetTextAttribute(textAttr);
- if (!string.IsNullOrEmpty(listBoxParam.FieldName))
- {
- widget.SetFieldName(listBoxParam.FieldName);
- }
- else
- {
- widget.SetFieldName(string.Format("ComBoBox{0}", widget.Page.GetAnnotCount()));
- }
- if (listBoxParam.OptionItems != null && listBoxParam.OptionItems.Count > 0)
- {
- int addIndex = 0;
- foreach (string key in listBoxParam.OptionItems.Keys)
- {
- widget.AddOptionItem(addIndex, listBoxParam.OptionItems[key], key);
- addIndex++;
- }
- }
- if (listBoxParam.SelectItemsIndex != null && listBoxParam.SelectItemsIndex.Count > 0)
- {
- widget.SelectItem(listBoxParam.SelectItemsIndex[0]);
- }
- DefaultWidget(widget, listBoxParam);
- }
- private void DefaultSignatureFields(CPDFAnnotation cPDFAnnotation, AnnotParam annotParam)
- {
- CPDFSignatureWidget widget = (cPDFAnnotation as CPDFSignatureWidget);
- if (widget == null)
- {
- return;
- }
- SignatureParam signatureParam;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- signatureParam = defaultSettingParam.SignatureParamDef;
- }
- else
- {
- signatureParam = annotParam as SignatureParam;
- }
- CTextAttribute textAttr = widget.GetTextAttribute();
- textAttr.FontColor = signatureParam.FontColor;
- textAttr.FontSize = (float)signatureParam.FontSize;
- bool isBold = IsBold(textAttr.FontName);
- bool isItalic = IsItalic(textAttr.FontName);
- textAttr.FontName = signatureParam.FontName;
- widget.SetTextAttribute(textAttr);
- if (!string.IsNullOrEmpty(signatureParam.FieldName))
- {
- widget.SetFieldName(signatureParam.FieldName);
- }
- else
- {
- widget.SetFieldName(string.Format("ComBoBox{0}", widget.Page.GetAnnotCount()));
- }
- DefaultWidget(widget, signatureParam);
- }
- #endregion
- }
- }
|