Add, Edit, and Delete Cloud Shapes in PDF Files with Ease in WPF
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (173).NET Core  (29).NET MAUI  (203)Angular  (107)ASP.NET  (51)ASP.NET Core  (82)ASP.NET MVC  (89)Azure  (40)Black Friday Deal  (1)Blazor  (211)BoldSign  (13)DocIO  (24)Essential JS 2  (106)Essential Studio  (200)File Formats  (65)Flutter  (132)JavaScript  (219)Microsoft  (118)PDF  (81)Python  (1)React  (98)Streamlit  (1)Succinctly series  (131)Syncfusion  (897)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (50)Windows Forms  (61)WinUI  (68)WPF  (157)Xamarin  (161)XlsIO  (35)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (8)Business intelligence  (55)Button  (4)C#  (146)Chart  (127)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (63)Development  (618)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (39)Extensions  (22)File Manager  (6)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  (501)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (42)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  (10)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (381)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (17)Web  (582)What's new  (323)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Add, Edit, and Delete Cloud Shapes in PDF Files with Ease in WPF

Add, Edit, and Delete Cloud Shapes in PDF Files with Ease in WPF

From the 2021 Essential Studio Volume 2 release, the WPF PDF Viewer comes with exciting support for drawing cloud shapes in PDF files. As per the PDF specification, cloud shapes are nothing but a polygon or rectangle annotation with a cloud border style. You can view, add, remove, and modify cloud shapes in PDF files interactively using the WPF PDF Viewer.

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

A polygon with cloud border style in PDF file
A polygon with cloud border style

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 cloud shapes from the UI

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

Selecting cloud from the PDF Vewer WPF toolbar
Selecting cloud from the toolbar

Once the cloud is chosen from the toolbar, click on the page to start creating a cloud. Move the pointer where you want them and click to create each segment. To finish drawing the cloud, double-click to end the cloud shape. Later, you can select and move them to adjust their location, or resize the cloud using its segment connection points to adjust its size.

The following image illustrates the appearance of a selected cloud and its segment connected points.

Cloud in the selected state
Cloud in the selected state

Note: For complex cloud polygons, the cloud border-style appearance might differ from other PDF readers like Adobe.

Enable cloud-shape drawing mode programmatically

If you are using the PdfDocumentView control and need to switch to the cloud-shape drawing mode, you need to set the AnnotationMode to Polygon or Rectangle, and the BorderEffect settings to Cloudy.

Refer to the following code example to enable cloud-shape drawing mode.

public void EnableCloudDrawingMode()
{
   pdfViewer.AnnotationMode = PdfViewerAnnotationMode.Polygon;
   pdfViewer.PolygonAnnotationSettings.BorderEffect = BorderEffect.Cloudy;
}

Remove cloud shapes

You can remove a cloud annotation by selecting and right-clicking the cloud shape. Choose Delete from the context menu. You can also delete the selected annotation using the DELETE keyboard key.

Delete cloud annotation in PDF Viewer WPF
Delete cloud annotation

Customize the properties of cloud shapes

You can customize the shape appearance, such as its color, thickness, opacity, and border style, using the properties window of the annotation. You can also modify the subject and author information of the annotation. To do so, open the properties window by selecting and right-clicking on the cloud shape, then choose the Properties from the context menu.

Properties window
Properties window

Customize the default appearance

If you need to create cloud shapes with a customized appearance, you can customize the default appearance using the PolygonSettings of PDF Viewer.

Refer to the following code example to customize the default appearance of a cloud shape.

public void EnableDefaultCloudSettings()
{
    pdfViewer.AnnotationMode = PdfViewerAnnotationMode.Polygon;
    pdfViewer.PolygonAnnotationSettings.BorderEffect = BorderEffect.Cloudy;

    // Set the default appearance of the cloud.
    pdfViewer.PolygonAnnotationSettings.StrokeColor = Colors.Red;
    pdfViewer.PolygonAnnotationSettings.FillColor = Colors.White;
    pdfViewer.PolygonAnnotationSettings.Thickness = 2;
    pdfViewer.PolygonAnnotationSettings.Opacity = 0.5f;

}

The following image illustrates the customized appearance of a cloud shape.

The customized appearance of cloud
The customized appearance of cloud

Pop-up note

Also, you can write custom notes for the annotation by using the pop-up note associated with the annotation. The pop-up note of the cloud annotation can be opened by selecting and right-clicking on the cloud 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 cloud shape annotations:

  • CTRL + Z: Undo the changes.
  • CTRL + Y: Redo the changes.
  • ESCAPE: Cancel the current cloud-shape drawing, which is in progress; (or) deselect the annotation if it is selected; (or) reset the cloud 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, left (direction keys): Move the cloud up, down, right, and left, respectively.
  • Delete: Delete the selected annotation.

Resource

For more information, refer to cloud shape annotations in WPF PDF Viewer.

Conclusion

Thank you for reading this blog. I hope that you enjoyed learning about how to add, remove, and modify cloud shapes in your PDF files using the Syncfusion WPF PDF Viewer. Try using our PDF Viewer in your application and let us know what you think in the comment section below. This feature is available in our 2021 Volume 2 release. To see all the updates in this release, please check out our Release Notes and What’s New pages.

If you are not a customer yet, you can start a 30-day free trial to check out these 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!

Reference links

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