Rank: Newbie
Groups: Registered
Joined: 3/4/2020(UTC) Posts: 2 
|
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)))) Edited by moderator Tuesday, March 17, 2020 9:05:16 PM(UTC)
| Reason: Not specified
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
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();
|
|
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 3/4/2020(UTC) Posts: 2 
|
|
|
|
|
|
|
Forum Jump
You can post new topics in this forum.
You can reply to topics in this forum.
You can delete your posts in this forum.
You can edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close