Add, Edit, and Delete Cloud Shapes in PDF Files with Ease in WPF
Tags: csharp, dotnet, wpf, pdf
Published: 2021-07-23 12:03:15

---
title: Add, Edit, and Delete Cloud Shapes in PDF Files with Ease in WPF
published: true
date: 2021-07-23 10:47:59 UTC
tags: csharp, dotnet, wpf, pdf
canonical_url: https://www.syncfusion.com/blogs/post/add-edit-delete-cloud-shapes-in-pdf-files-wpf.aspx
cover_image: https://www.syncfusion.com/blogs/wp-content/uploads/2021/07/Add-Edit-and-Delete-Cloud-Shapes-in-PDF-Files-with-Ease-in-WPF-1-672x372.png
---

From the [2021 Essential Studio Volume 2 release](https://www.syncfusion.com/forums/166800/essential-studio-2021-volume-2-main-release-v19-2-0-44-is-available-for-download "Link to download Essential Studio 2021 Vol 2"), the [WPF PDF Viewer](https://www.syncfusion.com/wpf-controls/pdf-viewer "Link to 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](https://www.syncfusion.com/blogs/wp-content/uploads/2021/07/Polygon-with-cloud-border-style.png)<figcaption>A polygon with cloud border style</figcaption>

## Getting started

First things first:

1. [Create a new WPF project ](https://docs.microsoft.com/en-us/dotnet/desktop/wpf/getting-started/walkthrough-my-first-wpf-desktop-application "Link to Tutorial: Create a new WPF app (WPF .NET)")and install the [WPF PDF Viewer NuGet package](https://www.nuget.org/packages/Syncfusion.PdfViewer.WPF/ "Link to Syncfusion.PdfViewer.WPF NuGet package").
2. Then, include the following code in your XAML page to add the PDF Viewer as a child to the window.
```html
<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](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfViewerControl.html "Link to user guide of PdfViewerControl class"), 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](https://www.syncfusion.com/blogs/wp-content/uploads/2021/07/Selecting-cloud-from-toolbar.png)<figcaption>Selecting cloud from the toolbar</figcaption>

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](https://www.syncfusion.com/blogs/wp-content/uploads/2021/07/Cloud-in-selected-state.png)<figcaption>Cloud in the selected state</figcaption>

**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](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfDocumentView.html "Link to user guide of PdfDocumentView class") control and need to switch to the cloud-shape drawing mode, you need to set the [AnnotationMode](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfDocumentView.html#Syncfusion_Windows_PdfViewer_PdfDocumentView_AnnotationMode "Link to the AnnotationMode property of PdfDocumentView") to Polygon or Rectangle, and the [BorderEffect](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfViewerPolygonSettings.html#Syncfusion_Windows_PdfViewer_PdfViewerPolygonSettings_BorderEffect "Link to the BorderEffect property of PdfDocumentView") settings to Cloudy.

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

```csharp
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](https://www.syncfusion.com/blogs/wp-content/uploads/2021/07/Delete-cloud-annotation.png)<figcaption>Delete cloud annotation</figcaption>

## 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](https://www.syncfusion.com/blogs/wp-content/uploads/2021/07/Properties-window-1.png)<figcaption>Properties window</figcaption>

## Customize the default appearance

If you need to create cloud shapes with a customized appearance, you can customize the default appearance using the [PolygonSettings](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.PdfViewer.PdfViewerPolygonSettings.html "Link to the Class PdfViewerPolygonSettings") of PDF Viewer.

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

```csharp
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](https://www.syncfusion.com/blogs/wp-content/uploads/2021/07/Customized-appearance-of-cloud.png)<figcaption>The customized appearance of cloud</figcaption>

## 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](https://www.syncfusion.com/blogs/wp-content/uploads/2021/07/Pop-up-note.png)<figcaption>Pop-up note</figcaption>

## 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](https://github.com/SyncfusionExamples/WPF-PDFViewer-Examples/tree/master/Annotations/Cloud "Link to Cloud Shape Annotations in WPF PDF Viewer demo on GitHub").

## 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](https://www.syncfusion.com/wpf-controls/pdf-viewer "Link to 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](https://www.syncfusion.com/forums/166800/essential-studio-2021-volume-2-main-release-v19-2-0-44-is-available-for-download "Link to download Essential Studio 2021 Volume 2") release. To see all the updates in this release, please check out our [Release Notes](https://help.syncfusion.com/common/essential-studio/release-notes/v19.2.0.44 "Link to Syncfusion release notes") and [What’s New](https://www.syncfusion.com/products/whatsnew "Link to Syncfusion What's New") pages.

If you are not a customer yet, you can start a 30-day [free trial](https://www.syncfusion.com/downloads "Link to the free evaluation of the Syncfusion Essential Studio") 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 forum](https://www.syncfusion.com/forums "Link to the Syncfusion support forum"), [feedback portal](https://www.syncfusion.com/feedback "Link to Syncfusion Feedback Portal"), or [Direct-Trac support system](https://www.syncfusion.com/support/directtrac/incidents "Link to the Syncfusion support system Direct Trac"). We are always happy to assist you!

## Reference links

- [Polygon annotation](https://help.syncfusion.com/wpf/pdf-viewer/working-with-annotations/shape-annotations#polygon-annotation "Link to Polygon Annotation in WPF PDF Viewer documentation")
- [Rectangle annotation](https://help.syncfusion.com/wpf/pdf-viewer/working-with-annotations/shape-annotations#rectangle-annotation "Link to Rectangle Annotation in WPF PDF Viewer documentation")
- [Cloud-border style](https://help.syncfusion.com/wpf/pdf-viewer/working-with-annotations/shape-annotations#border-styles "Link to Border Styles in WPF PDF Viewer documentation")

## Related blogs

- [How to Redact Confidential Data Permanently from PDF Files in WPF](https://dev.to/karthickramasamy08/how-to-redact-confidential-data-permanently-from-pdf-files-in-wpf-k7a-temp-slug-1897214 "Link to How to Redact Confidential Data Permanently from PDF Files in WPF blog")
- [Rotate, Remove, and Rearrange PDF Pages Easily with WPF PDF Viewer](https://dev.to/syncfusion/rotate-remove-and-rearrange-pdf-pages-easily-with-wpf-pdf-viewer-38p1 "Link to Rotate, Remove, and Rearrange PDF Pages Easily with WPF PDF Viewer blog")
- [Problems Applying Right-to-Left Rendering in WPF PDF Viewer?](https://dev.to/syncfusion/problems-applying-right-to-left-rendering-in-wpf-pdf-viewer-2pmm "Link to Problems Applying Right-to-Left Rendering in WPF PDF Viewer? blog")
- [PDF to Image Conversion is Made Easy with WPF PDF Viewer](https://dev.to/karthickramasamy08/pdf-to-image-conversion-is-made-easy-with-wpf-pdf-viewer-36fo-temp-slug-4978779 "Link to PDF to Image Conversion is Made Easy with WPF PDF Viewer blog")