Skip to content
Merged
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
26 changes: 13 additions & 13 deletions MAUI/PDF-Viewer/Add-Remove-Modify-Annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ control: SfPdfViewer
documentation: ug
---

# Add, Remove and Edit Annotations
# Add, Remove and Edit Annotations in .NET MAUI PDF Viewer (SfPdfViewer)

This section will go through the various functions available in the [SfPdfViewer](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html) for adding, removing and editing annotations in a PDF document.

## Add Annotations to a PDF Document
## Add annotations to a PDF document

This section will go through how to add annotations to a PDF document programmatically.

### Add Annotations Programmatically
### Add annotations programmatically

You can add a new annotation to the PDF document programmatically by creating an annotation instance and providing it as a parameter to the `AddAnnotation` method. The following example shows how to create an instance of a circle annotation and add it to the PDF document. Similarly, you can create and add other types of annotation.

Expand All @@ -42,7 +42,7 @@ void AddCircleAnnotation()
{% endhighlight %}
{% endtabs %}

### Annotation Added Event
### AnnotationAdded event

The `AnnotationAdded` event occurs when an annotation is added successfully to the PDF document. The following example explains how to wire and handle the event.

Expand All @@ -62,11 +62,11 @@ private void OnAnnotationAdded(object sender, AnnotationEventArgs e)
{% endhighlight %}
{% endtabs %}

## Remove Annotations from the PDF Document
## Remove annotations from the PDF document

This section will go through different methods of removing annotations from a PDF document.

### Remove the Selected Annotation
### Remove the selected annotation

You can remove the selected annotation programmatically by providing the selected annotation instance as the parameter to `RemoveAnnotation` method. The selected annotation instance may be obtained from the `AnnotationSelected` event. The following example shows how to remove the selected annotation.

Expand All @@ -86,7 +86,7 @@ void RemoveSelectedAnnotation(Annotation selectedAnnotation)

In desktop platforms like macOS and Windows, you can also use the keyboard shortcut `Delete` to remove the selected annotation from the PDF document directly.

### Remove Specific Annotation
### Remove a specific annotation

You can remove an annotation from the document programmatically by providing the specific annotation instance as the parameter to `RemoveAnnotation` method of `SfPdfViewer`. The following example shows how to remove the first annotation in the annotation collection from a PDF document.

Expand All @@ -106,7 +106,7 @@ void RemoveFirstAnnotation()
{% endhighlight %}
{% endtabs %}

### Remove all the Annotations
### Remove all the annotations

You can remove all the annotations from a document programmatically by calling `RemoveAllAnnotations` method. The following example shows how to remove all the annotations from a PDF document.

Expand All @@ -120,7 +120,7 @@ void RemoveAllAnnotations()
{% endhighlight %}
{% endtabs %}

### Annotation Removed Event
### AnnotationRemoved event

The `AnnotationRemoved` event occurs when an annotation is removed successfully from the PDF document. The following example explains how to wire and handle the event.

Expand All @@ -140,11 +140,11 @@ private void OnAnnotationRemoved(object sender, AnnotationEventArgs e)
{% endhighlight %}
{% endtabs %}

## Editing Annotations
## Edit annotations

This section will go through different methods of editing annotations in a PDF document programmatically.

### Editing a Specific Annotation
### Edit a specific annotation

You can edit the properties of an annotation from the document programmatically by accessing the specific annotation instance from the `Annotations` property of the SfPdfViewer. The following example shows how to edit the first annotation in the annotation collection. Similarly, you can modify the other properties also.

Expand Down Expand Up @@ -173,7 +173,7 @@ void EditFirstAnnotation()
{% endhighlight %}
{% endtabs %}

### Editing the Selected Annotation
### Edit the selected annotation

You can edit the properties of the selected annotation programmatically by accessing the selected annotation instance. The selected annotation instance may be obtained from the `AnnotationSelected` event. The following example shows how to edit the selected annotation assuming that the annotation is a circle type.

Expand All @@ -200,7 +200,7 @@ void EditSelectedAnnotation(Annotation selectedAnnotation)
{% endhighlight %}
{% endtabs %}

### Annotation Edited Event
### AnnotationEdited event

The `AnnotationEdited` event occurs when an annotation is edited in the PDF document. The following example explains how to wire and handle the event.

Expand Down
2 changes: 1 addition & 1 deletion MAUI/PDF-Viewer/Annotation-Collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ control: SfPdfViewer
documentation: ug
---

# Annotation Collection
# Annotation Collection in .NET MAUI PDF Viewer (SfPdfViewer)

The existing annotations in a PDF document can be accessed using the `Annotations` property of the [SfPdfViewer](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html). This read only property will have the annotation collection information as soon as the document is loaded into the PDF Viewer. The following example explains how to use the property to obtain the information about a square annotation that is the first on a specific document.

Expand Down
2 changes: 1 addition & 1 deletion MAUI/PDF-Viewer/Annotations-Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ control: SfPdfViewer
documentation: ug
---

# Annotations
# Annotations in .NET MAUI PDF Viewer (SfPdfViewer)

The [SfPdfViewer](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html) allows you to add, remove and modify annotations in the PDF documents. This section will go through the various annotation types available in PDF Viewer.

Expand Down
2 changes: 1 addition & 1 deletion MAUI/PDF-Viewer/Document-Link-Annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ control: SfPdfViewer
documentation: ug
---

# Document link navigation
# Document Link Navigation in .NET MAUI PDF Viewer (SfPdfViewer)

The PDF viewer allows navigating from one part of the PDF document to another using document link annotations. When a document link annotation is tapped, the PDF viewer scrolls to its destination. This type of link annotations is most often used to represent the table of contents of a PDF document.

Expand Down
46 changes: 23 additions & 23 deletions MAUI/PDF-Viewer/DocumentLoadNotifications.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
layout: post
title: Document Load Notifications in .NET MAUI PDF Viewer control | Syncfusion
title: Document Load Events in .NET MAUI PDF Viewer control | Syncfusion
description: Learn here all about events that notifies whether the document has been opened or not opened in the Syncfusion .NET MAUI PDF Viewer (SfPdfViewer).
platform: MAUI
control: SfPdfViewer
documentation: ug
---

# Document Load Notifications in .NET MAUI PDF Viewer (SfPdfViewer)
# Document Load Events in .NET MAUI PDF Viewer (SfPdfViewer)

The [SfPdfViewer](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html) supports the [DocumentLoaded](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html#Syncfusion_Maui_PdfViewer_SfPdfViewer_DocumentLoaded) and [DocumentLoadFailed](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html#Syncfusion_Maui_PdfViewer_SfPdfViewer_DocumentLoadFailed) events to notify whether the document has been opened and displayed in the view or not.

Expand Down Expand Up @@ -62,17 +62,17 @@ The [DocumentLoadFailedEventArgs](https://help.syncfusion.com/cr/maui/Syncfusion
{% tabs %}
{% highlight XAML hl_lines="3" %}

<syncfusion:SfPdfViewer
x:Name="PdfViewer"
DocumentLoadFailed="PdfViewer_DocumentLoadFailed"/>
<syncfusion:SfPdfViewer
x:Name="PdfViewer"
DocumentLoadFailed="PdfViewer_DocumentLoadFailed"/>

{% endhighlight %}
{% highlight C# %}

private void PdfViewer_DocumentLoadFailed(object sender, DocumentLoadFailedEventArgs e)
{
DisplayAlert( e.Message, e.Exception.StackTrace, "OK");
}
private void PdfViewer_DocumentLoadFailed(object sender, DocumentLoadFailedEventArgs e)
{
DisplayAlert( e.Message, e.Exception.StackTrace, "OK");
}

{% endhighlight %}
{% endtabs %}
Expand All @@ -84,24 +84,24 @@ The `DocumentLoadFailed` event allows you to handle the load failures at the app
{% tabs %}
{% highlight XAML hl_lines="3" %}

<syncfusion:SfPdfViewer
x:Name="PdfViewer"
DocumentLoadFailed="PdfDocumentLoadFailed"/>
<syncfusion:SfPdfViewer
x:Name="PdfViewer"
DocumentLoadFailed="PdfDocumentLoadFailed"/>

{% endhighlight %}
{% highlight C# hl_lines="4" %}

public MainPage()
{
InitializeComponent();
PdfViewer.DocumentLoadFailed += PdfDocumentLoadFailed;
}

private void PdfDocumentLoadFailed(object sender, DocumentLoadFailedEventArgs e)
{
e.Handled = true;
// Handle your logic here.
}
public MainPage()
{
InitializeComponent();
PdfViewer.DocumentLoadFailed += PdfDocumentLoadFailed;
}

private void PdfDocumentLoadFailed(object sender, DocumentLoadFailedEventArgs e)
{
e.Handled = true;
// Handle your logic here.
}

{% endhighlight %}
{% endtabs %}
63 changes: 63 additions & 0 deletions MAUI/PDF-Viewer/Gesture-Events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
layout: post
title: Gesture events in .NET MAUI PDF Viewer control | Syncfusion
description: This guide discusses about the gesture events provided by Syncfusion .NET MAUI PDF Viewer (SfPdfViewer) control.
platform: MAUI
control: SfPdfViewer
documentation: ug
---

# Gesture Events in .NET MAUI PDF Viewer (SfPdfViewer)

## Tapped event

The `SfPdfViewer` provides a `Tapped` event that occurs when a tap gesture is detected in the control and allows you to perform custom actions when a tap occurs. This event provides information about the page number and position at the tapped location through the `GestureEventArgs`.
The following code example demonstrates how to subscribe to the `Tapped` event.

{% tabs %}
{% highlight xaml %}
<syncfusion:SfPdfViewer x:Name="PdfViewer" Tapped="PdfViewer_Tapped"/>
{% endhighlight %}

{% highlight c# %}
SfPdfViewer PdfViewer = new SfPdfViewer();
PdfViewer.Tapped += PdfViewer_Tapped;
{% endhighlight %}
{% endtabs %}

In the above example, the `PdfViewer_Tapped` method is registered as the event handler for the Tapped event of the `SfPdfViewer`. The `PdfViewer_Tapped` method will be invoked whenever a tap occurs on the PDF Viewer. You can handle the custom action in the method as demonstrated in the following code example.

{% tabs %}
{% highlight c# %}
private void PdfViewer_Tapped(object sender, GestureEventArgs e)
{
// Handle the tap event here.
}
{% endhighlight %}
{% endtabs %}

### GestureEventArgs

The `GesturEventArgs` provides information available on the tapped location and it includes the following properties.

1. `PageNumber` – This property returns the page number on which the tap took place. The value ranges from 1 to the total number of pages in the PDF document. If the tap occurs outside of any PDF page boundaries, the result will be -1.
2. `PagePositon` – The property returns the page’s tapped position in the PDF coordinates. The coordinates have their origin at the top-left of the page. The number of the tapped page is identified by the `PageNumber` property. If the tap occurs outside of any PDF page boundaries, the result will be (-1, -1).
3. `Position` – This property returns the tapped position on the PDF Viewer control. The coordinate space starts at the top left of the control.

The following code example that demonstrates how to retrieve information from the `GestureEventArgs` and handle the tapped event.

{% tabs %}
{% highlight c# %}
private void PdfViewer_Tapped(object sender, GestureEventArgs e)
{
// To get the pointer position on the control where the tap occurred.
var pointerPosition = e.Position;
// To get the page number where the tap occurred.
var pageNumber = e.PageNumber;
// To get the page position where the tap occurred.
var pagePoistion = e.PagePosition;

// Handle the tap event here with the above information if required.
}
{% endhighlight %}
{% endtabs %}
36 changes: 18 additions & 18 deletions MAUI/PDF-Viewer/Hyperlink-Navigation.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,24 @@ The [HyperlinkClicked](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfVi
{% tabs %}
{% highlight XAML hl_lines="3" %}

<syncfusion:SfPdfViewer
x:Name="PdfViewer"
HyperlinkClicked="PdfHyperlinkClicked"/>
<syncfusion:SfPdfViewer
x:Name="PdfViewer"
HyperlinkClicked="PdfHyperlinkClicked"/>

{% endhighlight %}
{% highlight C# hl_lines="4" %}

public MainPage()
{
InitializeComponent();
PdfViewer.HyperlinkClicked += PdfHyperlinkClicked;
}

private async void PdfHyperlinkClicked(object sender, HyperlinkClickedEventArgs e)
{
e.Handled = true;
await Browser.Default.OpenAsync(e.Uri, BrowserLaunchMode.SystemPreferred);
}
public MainPage()
{
InitializeComponent();
PdfViewer.HyperlinkClicked += PdfHyperlinkClicked;
}

private async void PdfHyperlinkClicked(object sender, HyperlinkClickedEventArgs e)
{
e.Handled = true;
await Browser.Default.OpenAsync(e.Uri, BrowserLaunchMode.SystemPreferred);
}

{% endhighlight %}
{% endtabs %}
Expand All @@ -47,14 +47,14 @@ Enable or disable the recognition of hyperlinks in PDF documents using the [Enab
{% tabs %}
{% highlight XAML %}

<syncfusion:SfPdfViewer
x:Name="PdfViewer"
EnableHyperlinkNavigation="False"/>
<syncfusion:SfPdfViewer
x:Name="PdfViewer"
EnableHyperlinkNavigation="False"/>

{% endhighlight %}
{% highlight C# %}

PdfViewer.EnableHyperlinkNavigation = false;
PdfViewer.EnableHyperlinkNavigation = false;

{% endhighlight %}
{% endtabs %}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions MAUI/PDF-Viewer/Import-Export-Annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ control: SfPdfViewer
documentation: ug
---

# Import and Export Annotations
# Import and Export Annotations in .NET MAUI PDF Viewer (SfPdfViewer)

This section will go through the various functions available in the `SfPdfViewer` to import and export annotations in a PDF document.

## Import Annotations
## Import annotations

You can add annotations to a PDF document by importing them from FDF and XFDF files by using the `ImportAnnotations` method. You need to provide the stream of the file containing the annotations and the data format information as parameters to the method. The following example explains how to import annotations from an XFDF file, assuming that the file is in the application’s data directory.

Expand Down Expand Up @@ -90,4 +90,4 @@ void ExportSpecificAnnotations()
{% endhighlight %}
{% endtabs %}

* Similarly, you may export specific list of annotations into an FDF file.
* Similarly, you may export specific list of annotations into an FDF file.
Loading