logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Post a reply
From:
Message:

Maximum number of characters in each post is: 32767
Bold Italic Underline   Highlight Quote Choose Language for Syntax Highlighting Insert Image Insert an existing Attachment or upload a new File... Create Link   Unordered List Ordered List   Left Justify Center Justify Right Justify   Outdent Indent   More BBCode Tags
Font Color Font Size
Security Image:
Enter The Letters From The Security Image:
  Preview Post Cancel

Last 10 Posts (In reverse order)
jmclsdy Posted: Wednesday, March 18, 2020 2:34:41 AM(UTC)
 
thank you,very good
Paul Rayman Posted: Wednesday, March 18, 2020 12:21:40 AM(UTC)
 
you have two ways to create an underline annotation

1.
Code:

var page = pdfViewer1.Document.Pages[0];
if (page.Annots == null)
	page.CreateAnnotations();
page.Annots.Add(new PdfUnderlineAnnotation(page, new FS_POINTF(40, 450), new FS_POINTF(140, 490), new FS_POINTF(130, 400), new FS_POINTF(30, 360), FS_COLOR.Black));
page.Dispose();


2.
Code:

var underlineAnnotWithoutAppearance = new PdfUnderlineAnnotation(page);
underlineAnnotWithoutAppearance.Color = FS_COLOR.Blue;
underlineAnnotWithoutAppearance.Opacity = 1.0f;
underlineAnnotWithoutAppearance.QuadPoints = new PdfQuadPointsCollection();
underlineAnnotWithoutAppearance.QuadPoints.Add(new FS_QUADPOINTSF(20, 40, 120, 40, 20, 10, 120, 10));
underlineAnnotWithoutAppearance.QuadPoints.Add(new FS_QUADPOINTSF(130, 80, 300, 180, 140, 10, 250, 40));
page.Annots.Add(underlineAnnotWithoutAppearance);
underlineAnnotWithoutAppearance.RegenerateAppearances();
page.Dispose();

jmclsdy Posted: Tuesday, March 17, 2020 3:50:01 AM(UTC)
 
hi:

Code:
Private Sub addUnderlineannot(ByVal page As PdfPage,byval rect As FS_RECTF)
		If page.Annots Is Nothing Then page.CreateAnnotations()	
		Dim pathobj =PdfPathObject.Create(FillModes.Winding,True)
		pathObj.Path.AppendRect(rect)
		pathObj.StrokeColor = FS_COLOR.Transparent
		pathObj.FillColor =  FS_COLOR.Transparent 
		pathObj.CalcBoundingBox()
		Dim annot As PdfTextMarkupAnnotation 
		annot=New PdfUnderlineAnnotation(page)
		annot.Color = FS_COLOR.Black 
		annot.Opacity = 1.0f
		annot.Rectangle = rect	
		annot.QuadPoints.add((new FS_QUADPOINTSF(rect)))
		annot.CreateEmptyAppearance(AppearanceStreamModes.Normal)
		annot.NormalAppearance.Add(pathobj)	
		annot.GenerateAppearance(AppearanceStreamModes.Normal)	
		page.annots.Add(annot)
		page.Dispose()
	End Sub


1、Object reference is not set to an instance of the object
2、Don't show the underline(Delete this line annot.QuadPoints.add((new FS_QUADPOINTSF(rect))))