BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
Hello,
We are currently exploring the PDF Viewer functionality and to figure out if we can use it inside our projects.
One thing we would like to do is set additional options to the annotation when it is added, for instance by adding a subject or modifying the color.
Right now we are using the AnnotationAdded event but when we try to update the properties of the annotation that is added it doesn't show in the viewer.
Is there a way were we can set the annotation properties before they are processed in the viewer so they are returned correctly?
Some sample code:
<SfPdfViewerServer DocumentPath="@DocumentPath" Height="800px" Width="1060px" >
<PdfViewerEvents AnnotationAdded="annotationAdd">
</PdfViewerEvents>
</SfPdfViewerServer>
@code{
private string DocumentPath { get; set; } = "wwwroot/files/test_03.pdf";
public void annotationAdd(AnnotationAddEventArgs args)
{
// Update the subject of the annotation
args.AnnotationProperties.Subject = "test subject";
// Update the color of the annotation
args.AnnotationProperties.Color = "#7DF066";
}
}
Thanks!
The annotation add event property is to get the annotation data while adding annotation, we cannot add color in that event.
We can add color using the below code snippet.
Code Snippet:
public static PdfViewerAnnotationSelectorSettings selectorSettings = new PdfViewerAnnotationSelectorSettings { ResizerSize = 20, ResizerFillColor = "Yellow"};
public PdfViewerRectangleSettings rectangleSettings = new PdfViewerRectangleSettings
{
AnnotationSelectorSettings = selectorSettings,
FillColor = "green"
};
public static PdfViewerStampSettings stampSettings = new PdfViewerStampSettings
{
AnnotationSelectorSettings = selectorSettings,
FillColor = "green"
};
public static PdfViewerFreeTextSettings freeTextSettings = new PdfViewerFreeTextSettings
{
AnnotationSelectorSettings = selectorSettings,
FillColor = "blue"
};
Kindly find the sample - https://www.syncfusion.com/downloads/support/directtrac/general/ze/SERVER_Sample-2075840481-445627764.zip
Kindly let us know if you have any concerns.
Thanks for response!
I think I did not explain the situation correctly.
What we would like to achieve is the following process:
Sorry, we don’t have support for your requirement “Text highlight settings must be applied programmatically”, we have logged feature feedback and it will be available in any of our upcoming volume releases next year.
Kindly find the feedback below to track the status of the feature.
Feature - Text highlight settings must be applied programmatically | Feature Feedback