Skip to content

FLUT-889763-[documentation][flutter]: Revamp the Flutter PDF viewer UG #872

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: development
Choose a base branch
from
12 changes: 6 additions & 6 deletions Flutter/pdf-viewer/add-remove-modify-annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ documentation: ug

# Add, Remove, Edit Annotations in Flutter PDF Viewer widget (Syncfusion)

This section will go through the various functions available in the `SfPdfViewer` for adding, removing, and editing annotations in a PDF document.
This section will go through the various functions available in the [SfPdfViewer](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/SfPdfViewer-class.html) for adding, removing, and editing annotations in 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

You can programmatically add a new annotation to the PDF document by creating an annotation instance and providing it as a parameter to the `addAnnotation` method of the `PdfViewerController` class. The following example shows how to create an instance of a highlight annotation and add it to the PDF document. Similarly, you can create and add other types of annotation.
You can programmatically add a new annotation to the PDF document by creating an annotation instance and providing it as a parameter to the [addAnnotation](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController/addAnnotation.html) method of the [PdfViewerController](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController-class.html) class. The following example shows how to create an instance of a highlight annotation and add it to the PDF document. Similarly, you can create and add other types of annotation.

{% tabs %}
{% highlight dart hl_lines="11" %}
Expand All @@ -41,7 +41,7 @@ void addHighlightAnnotation() {

### Annotation added callback

The callback provided to the `onAnnotationAdded` property is triggered when an annotation is successfully added to the PDF document. The following example shows how to use this callback.
The callback provided to the [onAnnotationAdded](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/SfPdfViewer/onAnnotationAdded.html) property is triggered when an annotation is successfully added to the PDF document. The following example shows how to use this callback.

{% tabs %}
{% highlight dart hl_lines="7 8 9" %}
Expand Down Expand Up @@ -69,7 +69,7 @@ This section will go through different methods of removing annotations from a PD

### Remove a specific annotation programmatically

You can programmatically remove an annotation from the document by providing the specific annotation instance as the parameter to the `removeAnnotation` method of `PdfViewerController`. The following example shows how to remove the first annotation in the annotation collection from a PDF document.
You can programmatically remove an annotation from the document by providing the specific annotation instance as the parameter to the [removeAnnotation](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController/removeAnnotation.html) method of [PdfViewerController](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController-class.html). The following example shows how to remove the first annotation in the annotation collection from a PDF document.

{% tabs %}
{% highlight dart hl_lines="8" %}
Expand All @@ -90,7 +90,7 @@ void removeFirstAnnotation() {

### Remove all the annotations

You can programmatically remove all the annotations from a document by calling the `removeAllAnnotations` method. The optional `pageNumber` parameter can be used to clear the form field data on a specific page. By default, the pageNumber parameter is 0. Refer to the following code example.
You can programmatically remove all the annotations from a document by calling the [removeAllAnnotations](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController/removeAllAnnotations.html) method. The optional `pageNumber` parameter can be used to clear the form field data on a specific page. By default, the `pageNumber` parameter is 0. Refer to the following code example.

{% tabs %}
{% highlight dart hl_lines="3 8" %}
Expand All @@ -110,7 +110,7 @@ void removeAllAnnotationsInFirstPage() {

### Annotation removed callback

The callback provided to the `onAnnotationRemoved` property is triggered when an annotation is removed successfully from the PDF document. The following example shows how to use this callback.
The callback provided to the [onAnnotationRemoved](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/SfPdfViewer/onAnnotationRemoved.html) property is triggered when an annotation is removed successfully from the PDF document. The following example shows how to use this callback.

{% tabs %}
{% highlight dart hl_lines="7 8 9" %}
Expand Down
2 changes: 1 addition & 1 deletion Flutter/pdf-viewer/annotation-collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ documentation: ug

# Annotation Collection in Flutter PDF Viewer widget (Syncfusion)

The annotations in the PDF document can be accessed by the `getAnnotations` method of the `PdfViewerController`. The return value of the function will have Annotation collection as soon as the document is loaded in the PDF viewer. The following code example shows how the annotation collection can be accessed.
The annotations in the PDF document can be accessed by the [getAnnotations](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController/getAnnotations.html) method of the [PdfViewerController](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController-class.html). The return value of the function will have Annotation collection as soon as the document is loaded in the PDF viewer. The following code example shows how the annotation collection can be accessed.

{% tabs %}
{% highlight dart hl_lines="9 10" %}
Expand Down
4 changes: 2 additions & 2 deletions Flutter/pdf-viewer/annotations-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ documentation: ug

# Annotations in Flutter PDF Viewer (SfPdfViewer)

The `SfPdfViewer` allows you to add, remove, and modify annotations in PDF documents. This section will go through the various types and functionalities available in PDF Viewer for working with annotations.
The [SfPdfViewer](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/SfPdfViewer-class.html) allows you to add, remove, and modify annotations in PDF documents. This section will go through the various types and functionalities available in PDF Viewer for working with annotations.

## Supported annotation types

The `SfPdfViewer` supports the following annotation types.
The [SfPdfViewer](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/SfPdfViewer-class.html) supports the following annotation types.
1. Highlight
2. Squiggly
3. Strikethrough
Expand Down
8 changes: 4 additions & 4 deletions Flutter/pdf-viewer/form-filling.md
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ class _HomePage extends State<HomePage> {

## Restrict the editing of form fields

To prevent editing the values of the form fields in the PDF document, set the `readOnly` property of the respective form field to `true`.
To prevent editing the values of the form fields in the PDF document, set the [readOnly](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfFormField/readOnly.html) property of the respective form field to `true`.

{% tabs %}
{% highlight dart hl_lines="17" %}
Expand Down Expand Up @@ -672,7 +672,7 @@ Widget build(BuildContext context) {

If you performed undesired actions when editing the form fields, you can undo and redo the action to restore the previous state.

The undo and redo operations are performed by assigning the `UndoHistoryController` instance to the `undoController` property of the `SfPdfViewer`. The UndoHistoryController class contains the `undo` and `redo` methods to perform the same, respectively. The `canUndo` and `canRedo` properties are used to check whether the undo and redo operations can be performed or not, respectively. The following code example illustrates how to perform the form filling undo and redo operations programmatically with the `SfPdfViewer`.
The undo and redo operations are performed by assigning the `UndoHistoryController` instance to the [undoController](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/SfPdfViewer/undoController.html) property of the `SfPdfViewer`. The UndoHistoryController class contains the [undo](https://api.flutter.dev/flutter/widgets/UndoHistoryController/undo.html) and [redo](https://api.flutter.dev/flutter/widgets/UndoHistoryController/redo.html) methods to perform the same, respectively. The [canUndo](https://api.flutter.dev/flutter/widgets/UndoHistoryValue/canUndo.html) and [canRedo](https://api.flutter.dev/flutter/widgets/UndoHistoryValue/canRedo.html) properties are used to check whether the undo and redo operations can be performed or not, respectively. The following code example illustrates how to perform the form filling undo and redo operations programmatically with the `SfPdfViewer`.

{% tabs %}
{% highlight dart hl_lines="12 13 21 22 29" %}
Expand Down Expand Up @@ -742,7 +742,7 @@ The `SfPdfViewer` supports the [PdfFormFieldFocusChangeCallback](https://pub.dev

### Form field focus change callback

The [onFormFieldFocusChange](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/SfPdfViewer/onFormFieldFocusChange.html) callback triggers when the focus changes in or out of the form field. The [PdfFormFieldFocusChangeDetails](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfFormFieldFocusChangeDetails-class.html) will return the `formField` instance and its focus change value in the `hasFocus` property. The following code example explains the same.
The [onFormFieldFocusChange](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/SfPdfViewer/onFormFieldFocusChange.html) callback triggers when the focus changes in or out of the form field. The [PdfFormFieldFocusChangeDetails](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfFormFieldFocusChangeDetails-class.html) will return the [formField](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfFormFieldFocusChangeDetails/formField.html) instance and its focus change value in the [hasFocus](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfFormFieldFocusChangeDetails/hasFocus.html) property. The following code example explains the same.

{% tabs %}
{% highlight dart hl_lines="9 10 11" %}
Expand All @@ -769,7 +769,7 @@ N> The `PdfFormFieldFocusChangeCallback` only triggers for text boxes and signat

### Form field value changed callback

The [onFormFieldValueChanged](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/SfPdfViewer/onFormFieldValueChanged.html) callback triggers when the value is changed in the form field. The [PdfFormFieldValueChangedDetails](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfFormFieldValueChangedDetails-class.html) the `formField` instance along with its `oldValue` and `newValue`. The following code example explains the same.
The [onFormFieldValueChanged](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/SfPdfViewer/onFormFieldValueChanged.html) callback triggers when the value is changed in the form field. The [PdfFormFieldValueChangedDetails](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfFormFieldValueChangedDetails-class.html) the [formField](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfFormFieldFocusChangeDetails/formField.html) instance along with its [oldValue](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfFormFieldValueChangedDetails/oldValue.html) and [newValue](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfFormFieldValueChangedDetails/newValue.html). The following code example explains the same.

{% tabs %}
{% highlight dart hl_lines="9 10 11 12" %}
Expand Down
Loading