123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341 |
- using ComPDFKit.PDFAnnotation.Form;
- using ComPDFKit.PDFAnnotation;
- using ComPDFKit.PDFDocument.Action;
- using ComPDFKit.PDFDocument;
- using ComPDFKit.Tool.SettingParam;
- using ComPDFKitViewer;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- 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);
- 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.SetBorderWidth(1);
- freeTextAnnotation.SetTransparency(FreeTextParam.Transparency);
- freeTextAnnotation.SetLineWidth((float)FreeTextParam.LineWidth);
- if (FreeTextParam.HasBgColor && freeTextAnnotation.BgColor.Length == 3)
- {
- freeTextAnnotation.SetBgColor(FreeTextParam.BgColor);
- }
- 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 strikeoutAnnotation = (cPDFAnnotation as CPDFStampAnnotation);
- if (strikeoutAnnotation == 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;
- }
- strikeoutAnnotation.SetStandardStamp(stampText, stampParam.Rotation);
- }
- 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)
- {
- strikeoutAnnotation.SetRect(new CRect(0, imageHeight, imageWidth, 0));
- strikeoutAnnotation.SetImageStamp(
- imageData,
- imageWidth,
- imageHeight,
- stampParam.Rotation);
- }
- }
- 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;
- }
- strikeoutAnnotation.SetTextStamp(
- stampText,
- dateText,
- stampParam.TextStampShape,
- stampParam.TextStampColor,
- stampParam.Rotation);
- }
- break;
- default:
- break;
- }
- 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);
- (cPDFAnnotation as CPDFInkAnnotation).SetInkPath(inkParam.InkPath);
- 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);
- if (PolyAnnotation == null)
- {
- return;
- }
- if (!PolyAnnotation.IsMeasured() && annotParam != null)
- {
- return;
- }
- PolygonMeasureParam MeasureParam;
- if (annotParam == null)
- {
- DefaultSettingParam defaultSettingParam = GetDefaultSettingParam();
- MeasureParam = defaultSettingParam.PolygonMeasureParamDef;
- }
- else
- {
- MeasureParam = annotParam as PolygonMeasureParam;
- }
- 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);
- }
- 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();
- }
- }
- 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;
- FontType checkFontType = CFontNameHelper.GetFontType(pushButtonParam.FontName);
- textAttr.FontName = CFontNameHelper.ObtainFontName(
- checkFontType == FontType.Unknown ? FontType.Helvetica : checkFontType,
- pushButtonParam.IsBold,
- pushButtonParam.IsItalic);
- 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;
- FontType checkFontType = CFontNameHelper.GetFontType(textBoxParam.FontName);
- textAttr.FontName = CFontNameHelper.ObtainFontName(
- checkFontType == FontType.Unknown ? FontType.Helvetica : checkFontType,
- textBoxParam.IsBold,
- textBoxParam.IsItalic);
- 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;
- FontType checkFontType = CFontNameHelper.GetFontType(comboBoxParam.FontName);
- textAttr.FontName = CFontNameHelper.ObtainFontName(
- checkFontType == FontType.Unknown ? FontType.Helvetica : checkFontType,
- comboBoxParam.IsBold,
- comboBoxParam.IsItalic);
- 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;
- FontType checkFontType = CFontNameHelper.GetFontType(listBoxParam.FontName);
- textAttr.FontName = CFontNameHelper.ObtainFontName(
- checkFontType == FontType.Unknown ? FontType.Helvetica : checkFontType,
- listBoxParam.IsBold,
- listBoxParam.IsItalic);
- 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);
- FontType checkFontType = CFontNameHelper.GetFontType(signatureParam.FontName);
- textAttr.FontName = CFontNameHelper.ObtainFontName(
- checkFontType == FontType.Unknown ? FontType.Helvetica : checkFontType,
- isBold,
- isItalic);
- 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
- }
- }
|