Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 36 additions & 4 deletions Document-Processing-toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -1097,15 +1097,47 @@
<li> <a href="/document-processing/pdf/pdf-viewer/blazor/hand-written-signature">Handwritten Signature</a></li>
<li>Annotations
<ul>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/text-markup-annotation">Text Markup</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/shape-annotation">Shape</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/overview">Overview</a></li>
<li>Text-markup
<ul>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/text-markup/highlight-annotation">Highlight</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/text-markup/underline-annotation">Underline</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/text-markup/strikethrough-annotation">Strikethrough</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/text-markup/squiggly-annotation">Squiggly</a></li>
</ul>
</li>
<li>Shape
<ul>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/shape/line-annotation">Line</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/shape/arrow-annotation">Arrow</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/shape/rectangle-annotation">Rectangle</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/shape/circle-annotation">Circle</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/shape/polygon-annotation">Polygon</a></li>
</ul>
</li>
<li>Measurement
<ul>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/measurement/distance-annotation">Distance</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/measurement/perimeter-annotation">Perimeter</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/measurement/area-annotation">Area</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/measurement/radius-annotation">Radius</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/measurement/volume-annotation">Volume</a></li>
</ul>
</li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/stamp-annotation">Stamp</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/sticky-notes-annotation">Sticky Notes</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/measurement-annotation">Measurement</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/free-text-annotation">Free Text</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/ink-annotation">Ink</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/comments">Comments</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/toolbar-customization/annotation-toolbar">Toolbar</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/create-modify-annotation">Create and Modify Annotation</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/customize-annotation">Customize Annotation</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/delete-annotation">Remove Annotation</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/annotations-undo-redo">Undo or Redo Annotation</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/annotation-permission">Annotation Permission</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/custom-data">Add Custom Data</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/flatten-annotation">Flatten Annotation</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/import-export-annotation">Import and Export</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/comments">Comments</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/annotations-in-mobile-view">Mobile View</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/annotation/events">Events</a></li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
---
layout: post
title: Annotation Permissions in Blazor SfPdfViewer Component | Syncfusion
description: Learn how to use annotation permissions in the Syncfusion Blazor SfPdfViewer to control annotation behavior and access.
platform: document-processing
control: SfPdfViewer
documentation: ug
---

# Annotation permissions in Blazor SfPdfViewer

Use [PdfViewerAnnotationSettings](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerAnnotationSettings.html) to control permissions and default behavior for all annotations in the Blazor SfPdfViewer. Additionally, configure permissions for individual annotation types using their respective settings classes. These settings establish defaults for annotations created through the UI and programmatic flows.

## Common permissions

Common permission properties that apply to all annotation types:

- `IsLock`: Lock annotations so they cannot be moved, resized, edited, or deleted.
- `IsPrint`: Control whether annotations participate in printing.
- `SkipDownload`: Skip annotations from the exported/downloaded PDF.

Example: Set common permissions using `PdfViewerAnnotationSettings` for all annotations in the SfPdfViewer.

```cshtml
@using Syncfusion.Blazor.SfPdfViewer

<SfPdfViewer2 DocumentPath="@DocumentPath"
Width="100%"
Height="100%">
<PdfViewerAnnotationSettings IsLock="false"
IsPrint="true"
SkipDownload="false">
</PdfViewerAnnotationSettings>
</SfPdfViewer2>

@code {
private string DocumentPath { get; set; } = "wwwroot/Data/PDF_Succinctly.pdf";
}
```

### Example: Lock all annotations by default

```cshtml
@using Syncfusion.Blazor.SfPdfViewer

<SfPdfViewer2 DocumentPath="@DocumentPath"
Width="100%"
Height="100%">
<PdfViewerAnnotationSettings IsLock="true"
IsPrint="true"
SkipDownload="true">
</PdfViewerAnnotationSettings>
</SfPdfViewer2>

@code {
private string DocumentPath { get; set; } = "wwwroot/Data/PDF_Succinctly.pdf";
}
```

## Individual annotation permissions

Set type-specific permissions to override common settings for particular annotation types:

- `IsLock`: Lock or unlock a specific annotation type.
- `IsPrint`: Control printing behavior for a specific annotation type.
- `SkipDownload`: Skip a specific annotation type from download behavior.

Example: Set individual permissions for different annotation types while maintaining common appearance settings.

```cshtml
@using Syncfusion.Blazor.SfPdfViewer

<SfPdfViewer2 DocumentPath="@DocumentPath"
Width="100%"
Height="100%">
<!-- Common permissions for all annotations -->
<PdfViewerAnnotationSettings IsLock="false"
IsPrint="true"
SkipDownload="false">
</PdfViewerAnnotationSettings>

<!-- Text Markup Settings with individual permissions -->
<PdfViewerHighlightSettings Author="QA"
Color="#ffff00"
Opacity="0.6"
IsLock="false"
IsPrint="true"
SkipDownload="false">
</PdfViewerHighlightSettings>

<PdfViewerStrikethroughSettings Author="QA"
Color="#ff0000"
Opacity="0.6"
IsLock="true"
IsPrint="false"
SkipDownload="true">
</PdfViewerStrikethroughSettings>

<!-- Shape Settings with individual permissions -->
<PdfViewerLineSettings StrokeColor="#0066ff"
Thickness="2"
Opacity="0.8"
IsLock="false"
IsPrint="true"
SkipDownload="false">
</PdfViewerLineSettings>

<PdfViewerCircleSettings FillColor="transparent"
StrokeColor="#222222"
Thickness="1"
Opacity="1"
IsLock="false"
IsPrint="true"
SkipDownload="false">
</PdfViewerCircleSettings>

<PdfViewerRectangleSettings FillColor="transparent"
StrokeColor="#222222"
Thickness="1"
Opacity="1"
IsLock="false"
IsPrint="true"
SkipDownload="false">
</PdfViewerRectangleSettings>

<!-- Measurement Settings with individual permissions -->
<PdfViewerDistanceSettings StrokeColor="#0066ff"
Thickness="2"
Opacity="0.8"
IsLock="false"
IsPrint="true"
SkipDownload="false">
</PdfViewerDistanceSettings>

<!-- Other Annotation Settings with individual permissions -->
<PdfViewerFreeTextSettings BorderColor="#222222"
Opacity="1"
IsLock="false"
IsPrint="true"
SkipDownload="false">
</PdfViewerFreeTextSettings>

<PdfViewerStampSettings Opacity="0.9"
IsLock="false"
IsPrint="true"
SkipDownload="false">
</PdfViewerStampSettings>
</SfPdfViewer2>

@code {
private string DocumentPath { get; set; } = "wwwroot/Data/PDF_Succinctly.pdf";
}
```

## Behavior notes

- `IsLock` = true: The annotation is locked; users cannot move, resize, or edit it through the UI until it is unlocked.
- `IsPrint` = true: Annotations participate in print output initiated from the viewer.
- `SkipDownload` = true: Annotations are excluded from the exported/downloaded PDF from the viewer.
- `IsLock` on individual annotation: Use this when you want to lock a specific annotation type while leaving others editable.

## See also

* [Annotation Overview](overview.md)
* [Create and Modify Annotations](create-modify-annotation.md)
* [Text Markup Annotations](text-markup/highlight-annotation.md)
* [Shape Annotations](shape/line-annotation.md)
* [Measurement Annotations](measurement/distance-annotation.md)
* [Annotation Undo/Redo](annotations-undo-redo.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
layout: post
title: Undo and Redo Annotation in Blazor SfPdfViewer Component | Syncfusion
description: Learn how to undo and redo annotation changes in the Syncfusion Blazor SfPdfViewer with UI and programmatic examples.
platform: document-processing
control: SfPdfViewer
documentation: ug
---

# Undo and redo annotations in Blazor SfPdfViewer

The Blazor SfPdfViewer supports undo and redo for annotations.

![Undo-redo](../images/annotation-undo-redo.png)

Undo and redo actions can be performed by using either of the following methods:

1. Using keyboard shortcuts (desktop):
After performing an annotation action, press `Ctrl+Z` to undo and `Ctrl+Y` to redo on Windows and Linux. On macOS, use `Command+Z` to undo and `Command+Shift+Z` to redo.
2. Using the toolbar:
Use the **Undo** and **Redo** tools in the toolbar.
3. Programmatically:
Call the [UndoAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_UndoAsync) and [RedoAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_RedoAsync) methods from the client side.

## Programmatic Undo and Redo

Refer to the following code snippet to call undo and redo actions programmatically.

```cshtml
@using Syncfusion.Blazor.Buttons
@using Syncfusion.Blazor.SfPdfViewer

<div style="margin-bottom: 8px;">
<SfButton OnClick="UndoAnnotation">Undo</SfButton>
<SfButton OnClick="RedoAnnotation">Redo</SfButton>
</div>

<SfPdfViewer2 @ref="viewer"
DocumentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
Height="650px"
Width="100%">
</SfPdfViewer2>

@code {
SfPdfViewer2 viewer;

public async void UndoAnnotation(MouseEventArgs args)
{
await viewer.UndoAsync();
}

public async void RedoAnnotation(MouseEventArgs args)
{
await viewer.RedoAsync();
}
}
```

## See also

- [Annotation Overview](./overview)
- [Text Markup Annotation](./text-markup/highlight-annotation)
- [Shape Annotation](./shape/line-annotation)
- [Measurement Annotation](./measurement/distance-annotation)
- [Free Text Annotation](./free-text-annotation)
- [Ink Annotation](./ink-annotation)
- [Stamp Annotation](./stamp-annotation)
- [Comments](./comments)
- [Delete Annotation](./delete-annotation)
- [Export and Import Annotation](./export-annotation)
Loading