We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Pressure,highlighter in InkAnnotation

I have some questions regarding the Ink Annotation class:
1)I created these methods to save and load the ink annotation:
load:
 foreach (PdfLoadedInkAnnotation note in page.Annotations.OfType<PdfLoadedInkAnnotation>())
                {
                    List<InkPoint> inkpoints = new List<InkPoint>();
                    for (i = 0, j = 1; j <= note.InkList.Count; i = i + 2, j = j + 2)
                    {
                        inkpoints.Add(new InkPoint(new Windows.Foundation.Point(converter.ConvertToPixels(note.InkList[i] , PdfGraphicsUnit.Point), (converter.ConvertToPixels((note.InkList[j]), PdfGraphicsUnit.Point)),(float)0.5));
                    }
                    try
                    {
                        stroke = ink.CreateStrokeFromInkPoints(inkpoints, System.Numerics.Matrix3x2.Identity);
                        draw = new InkDrawingAttributes();
                        si = new Windows.Foundation.Size(note.BorderWidth, note.BorderWidth);
                        draw.Size = si;
                        clr.B = note.Color.B;
                        clr.G = note.Color.G;
                        clr.R = note.Color.R;
                        draw.Color = clr;
                        list.Add(stroke);
                    }
                    catch (Exception er)
                    {
                        System.Diagnostics.Debug.WriteLine(er.Message);
                    }
                }
save:

                             PdfInkAnnotation inkAnnot = new PdfInkAnnotation(new RectangleF(0, 0, (float)pageWidth, (float)pageHeight), inkPoints);
                           
                            inkAnnot.BorderWidth = (int)stroke.DrawingAttributes.Size.Width;
                            Windows.UI.Color clr1 = stroke.DrawingAttributes.Color;
                            inkAnnot.Color = new PdfColor(clr1.R, clr1.G, clr1.B);
                            ldoc.Pages[pagina].Annotations.Add(inkAnnot);


my questions are:
1) How can I implement the pressure?
The class InkPoint has x and y coordinates and pressure but I can not implement it, because the method save does not have any field for pressure.
2) Instead of using new "RectangleF (0, 0, (float) pageWidth, (float) pageHeight)"  I can use a circular shape?
3) how can I implement the highlighter?
I use a InkCanvas with inktoolbar, the highlight of InkCanvas exactly is a series of points as a simple stroke, I tried to implement the highlighter through PdfTextMarkupAnnotation Class but do not think is the right solution.
Thanks so much.


1 Reply

CM Chinnu Muniyappan Syncfusion Team November 9, 2016 12:43 PM UTC

Hi Andrea, 
 
Thank you for contacting Syncfusion support. 
 
1) How can I implement the pressure?
The class InkPoint has x and y coordinates and pressure but I can not implement it, because the method save does not have any field for pressure.
 
We do not have any field to set pressure to the ink annotation instead we do support to set BorderWidth of the PdfInkAnnotation to change the border width of the ink annotation, please refer the below code snippet. 
 
PdfInkAnnotation inkAnnot = new PdfInkAnnotation(new RectangleF(0, 0, (float)pageWidth, (float)pageHeight), inkPoints); 
 
//Set the ink annotation border width 
inkAnnot.BorderWidth = 1; 
 
2) Instead of using new "RectangleF (0, 0, (float) pageWidth, (float) pageHeight)"  I can use a circular shape? 
We do not have a support for draw the ink annotation to the circular shape, we can draw only in rectangle of the bounds, it is the default behavior. 
3) how can I implement the highlighter? 
I use a InkCanvas with inktoolbar, the highlight of InkCanvas exactly is a series of points as a simple stroke, I tried to implement the highlighter throughPdfTextMarkupAnnotation Class but do not think is the right solution.
Thanks so much.
 
 
We have created a sample for adding highlight annotations using PdfViewerControl. Please refer the below screenshot and sample for more details. 
 
 
 
 
Sample link: 
 
Please let us know whether this is your actual requirement or else provide more detail about your requirement, so that we will provide you a prompt solution  
 
Regards, 
Chinnu 


Loader.
Live Chat Icon For mobile
Up arrow icon