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

Notification

Icon
Error

Options
Go to last post Go to first unread
ESchunk  
#1 Posted : Tuesday, August 13, 2019 10:16:13 AM(UTC)
ESchunk

Rank: Newbie

Groups: Registered
Joined: 8/13/2019(UTC)
Posts: 2
United States
Location: New York

I'm trying to programmatically add a square annotation when a user clicks a button in a WPF app and have the annotation appear in the viewer. Is this possible?
The code in the button is listed below and is not working as the annotation does not appear after the button click. When is it necessary to call InvalidateVisual, ClearRenderBuffer and UpdateLayout?


if (page.Annots == null)
page.CreateAnnotations();


FS_RECTF rect = new FS_RECTF(left, top, right, bottom);
page.Annots.Add(new PdfSquareAnnotation(page, rect, FS_COLOR.Red, FS_COLOR.Green));

pdfViewer1.InvalidateVisual();
pdfViewer1.ClearRenderBuffer();
pdfViewer1.UpdateLayout();


Thanks,

Ted
Paul Rayman  
#2 Posted : Tuesday, August 13, 2019 11:46:01 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 779

Thanks: 1 times
Was thanked: 97 time(s) in 95 post(s)
Try to call page.Dispose instead of clear render buffer etc.
This will cause the page to reload and update all changes
Code:

...
page.Dispose();
pdfViewer1.InvalidateVisual();
ESchunk  
#3 Posted : Tuesday, August 13, 2019 12:41:46 PM(UTC)
ESchunk

Rank: Newbie

Groups: Registered
Joined: 8/13/2019(UTC)
Posts: 2
United States
Location: New York

That worked. Thanks
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.