Create, Edit, and Delete Arrows Shapes in PDF Files with Ease in WPF
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (175).NET Core  (29).NET MAUI  (208)Angular  (109)ASP.NET  (51)ASP.NET Core  (82)ASP.NET MVC  (89)Azure  (41)Black Friday Deal  (1)Blazor  (220)BoldSign  (15)DocIO  (24)Essential JS 2  (107)Essential Studio  (200)File Formats  (67)Flutter  (133)JavaScript  (221)Microsoft  (119)PDF  (81)Python  (1)React  (101)Streamlit  (1)Succinctly series  (131)Syncfusion  (920)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (51)Windows Forms  (61)WinUI  (68)WPF  (159)Xamarin  (161)XlsIO  (37)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (8)Business intelligence  (55)Button  (4)C#  (151)Chart  (132)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (63)Development  (633)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (41)Extensions  (22)File Manager  (7)Gantt  (18)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (508)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (43)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (52)Security  (3)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (11)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (387)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (597)What's new  (333)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Create, Edit, and Delete Arrows Shapes in PDF Files with Ease in WPF

Create, Edit, and Delete Arrows Shapes in PDF Files with Ease in WPF

Arrows are significant design elements. They serve as visual cues that guide and direct your users’ attention to related information and action areas. We can use them to connect, direct, or point out information in files. The arrow shapes can be particularly useful when reviewing contents in PDF files.

The Syncfusion WPF PDF Viewer provides easy ways to view, add, remove, and modify arrow shapes in PDF files quickly. It also allows you to draw arrows vertically, horizontally, and diagonally.

In this blog, we will look at the procedures to handle arrow shapes in PDF files using the WPF PDF Viewer.

Arrow shape annotation in reviewing PDF file
Arrow Shape Annotation in Reviewing a PDF File

Getting started

First things first:

  1. Create a new WPF project and install the WPF PDF Viewer NuGet package.
  2. Then, include the following code in your XAML page to add the PDF Viewer as a child to the window:
    <Window x:Class="PdfViewer.MainWindow"
            xmlns:pdfviewer="clr-namespace:Syncfusion.Windows.PdfViewer;assembly=Syncfusion.PdfViewer.WPF">
        <pdfviewer:PdfViewerControl x:Name="pdfViewer"/>
    </Window>

Add arrow shapes from the UI

Using the PdfViewerControl, you can directly add arrow shapes by selecting the Arrow from the shapes in the built-in toolbar.

Selecting arrow from the toolbar
Selecting Arrow from the Toolbar

After choosing the Arrow from the toolbar, click and drag on the page to start creating an arrow. Move the pointer where you want and release it to finish drawing the arrow. Later, you can select and move or resize the arrow to change its location or size.

Enable arrow-shape drawing mode programmatically

If you are using the PdfDocumentView control and need to switch to the arrow-shape drawing mode, then execute the AnnotationCommand with the CommandParameter set to Arrow.

Refer to the following code example to enable arrow-shape drawing mode:

XAML

<Button Command="{Binding ElementName= pdfViewer, Path=AnnotationCommand, Mode= OneWay }" CommandParameter="Arrow"/>

C#

private void EnableArrowDrawingMode()
   {
       if (pdfViewer.AnnotationCommand.CanExecute("Arrow"))
          pdfViewer.AnnotationCommand.Execute("Arrow");
   }

Note: To reset the annotation mode, you need to pass the CommandParameter as None.

Remove the arrows

We can easily remove an arrow by selecting and right-clicking the arrow shape. Then, choose the Delete option from the context menu. You can also remove the selected annotation using the DELETE keyboard key.

Delete arrow annotation
Delete Arrow Annotation

Customize the properties of arrow shapes

The properties window of the annotation allows us to customize the arrow’s appearance, such as style, color, thickness, and opacity. With this, you can also change the subject and author’s information. To do so, right-click on the arrow shape and choose Properties from the context menu.

Properties window
Properties Window

Customize the default appearance

Also, you can customize the default appearance of an arrow using the WPF PDF Viewer’s ArrowAnnotationSettings property.

Refer to the following code example:

private void SetDefaultArrowSettings()
   {
      pdfViewer.ArrowAnnotationSettings.BeginLineStyle = PdfLineEndingStyle.Circle;
      pdfViewer.ArrowAnnotationSettings.EndLineStyle = PdfLineEndingStyle.ClosedArrow;
      pdfViewer.ArrowAnnotationSettings.Opacity = 0.5f;
      pdfViewer.ArrowAnnotationSettings.StrokeColor = Colors.Blue;
      pdfViewer.ArrowAnnotationSettings.Thickness = 4;
   }
Customized Arrow Appearance
Customized Arrow Appearance

Customize the end styles of arrow shapes

You can also customize the end styles of an arrow. The following end styles are currently supported in the WPF PDF Viewer:

Style Appearance (End Style)
OpenOpen end style arrow
ClosedArrow with closed end style
Open (Reverse)Arrow open (Reverse) end style
Closed (Reverse)Arrow closed (Reverse) end style
ButtButt end style in arrow
DiamondDiamond end style in arrow
RoundRound end style in arrow shape
SquareSquare end style in arrow shape
SlashSlash end style in arrow shape
None (Normal line)None (Normal line) end style in arrow shape

Apart from these styles, you can also apply the desired styles to both ends of an arrow, like in the following screenshot.

Customized Arrow with Different Styles at Both Ends
Customized Arrow with Different Styles at Both Ends

Custom notes

Add custom notes for the annotation by using the pop-up note associated with the annotation. The pop-up note for the arrow annotation can be opened by selecting and right-clicking on the arrow shape and then choosing Open Pop-up Note from the context menu.

Pop-up note
Pop-up Note

Keyboard shortcuts summary

The following shortcut keys can be used with the arrow shape annotations:

  • Ctrl + Z: Undo the changes.
  • Ctrl + Y: Redo the changes.
  • Esc: Deselect the annotation if it is selected; (or) reset the arrow annotation mode; (or) close the properties window or pop-up note if it is open. One of these operations will be performed based on the priority order.
  • Up, Down, Right, and Left arrow keys: Move the arrow up, down, right, and left, respectively.
  • Delete: Delete the selected annotation.

References

For more information, refer to the arrow shape annotation in the WPF PDF Viewer GitHub demo and documentation.

Conclusion

Thank you for reading this blog. I hope that you enjoyed learning about how to add, remove, and modify arrow shapes in your PDF files using the Syncfusion WPF PDF Viewer. Arrow shapes are a great way to highlight a call to action, lead a visitor’s eye, or show a direction of flow. Try using our PDF Viewer to handle arrows in your application and let us know what you think in the comment section below.

Our PDF Viewer is also available in our Blazor, Flutter,  ASP.NET (Core, MVC, Web Forms), JavaScript, Angular, React, Vue, Xamarin, UWP,  WinForms, and WPF platforms.

If you are not a customer yet, you can start a 30-day free trial to check out the arrow annotation and other features.

If you wish to send us feedback or would like to submit any questions, you can contact us through our support forumfeedback portal, or Direct-Trac support system. We are always happy to assist you!

Related blogs

Tags:

Share this post:

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed