LEADTOOLS Support
General
General Questions
Fill custom color while adding annotations-Javascript
#1
Posted
:
Friday, March 31, 2023 2:06:26 AM(UTC)
Groups: Registered
Posts: 2
I have been following the solution provided in the sample
https://www.leadtools.co...he-document-viewer.html, But was not able to add custom color to the annotation, Could you please help me with some sample.
Update: I am looking to draw a rectangle with custom color.(the rectangle should be filled with : Red, Green, Blue etc selected color.)
Regards,
Noor
Edited by user Tuesday, April 4, 2023 9:03:40 AM(UTC)
| Reason: Not specified
#2
Posted
:
Saturday, October 7, 2023 5:14:26 AM(UTC)
Groups: Registered
Posts: 12
Thanks: 4 times
Here is an Ex..how to do that.
Quote:// Create a rectangle annotation
var annotation = new lt.Annotations.Engine.AnnRectangleObject();
// Set the rectangle's bounds
var bounds = new lt.LeadRectD(100, 100, 200, 150); // Modify the coordinates and size as needed
annotation.bounds = bounds;
// Set the custom fill color (e.g., Red)
var fillColor = new lt.Annotations.Engine.AnnSolidColorBrush();
fillColor.color = lt.Annotations.Engine.AnnColor.create(255, 0, 0); // Red color (R, G, B values)
annotation.fill = fillColor;
// Add the annotation to the container (viewer)
annContainer.children.add(annotation);
// Make sure to update the viewer to see the changes
viewer.invalidate(lt.LeadRectD.empty);
// Assuming 'viewer' is your LEADTOOLS viewer and 'annContainer' is your annotation container.
This is an example please adjust the size, and color values according to you...
The Doc you mention is not available So here is the update
doc.
LEADTOOLS Support
General
General Questions
Fill custom color while adding annotations-Javascript
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.