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
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,48 @@ The `SfPdfViewer` supports the following annotation types:
2. Squiggly
3. Strikethrough
4. Underline
5. Sticky Note
5. Sticky Note

## Setting the Default Author for Annotations

You can define a default author name for all annotations added to the PDF document using the [author](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfAnnotationSettings/author.html) property of the [annotationSettings](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController/annotationSettings.html). This helps identify who created the annotations, especially in collaborative or review workflows.

The following code explains how to set a default author name for the annotations.

{% tabs %}
{% highlight dart %}

void setDefaultAuthor() {
// Sets the default author.
_pdfViewerController.annotationSettings.author = 'John Doe';
}

{% endhighlight %}
{% endtabs %}

## Setting the Author and Subject for Individual Annotations

In addition to setting a default author for all annotations, you can assign a specific [author](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/Annotation/author.html) and [subject](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/Annotation/subject.html) to each annotation individually using an [Annotation](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/Annotation-class.html) instance.

The following code explains how to set the author name and subject for individual annotation.

{% tabs %}
{% highlight dart %}

/// Sets the author and subject for the last annotation in the PDF document.
void setMetadataForLastAnnotation() {
// Get the list of annotations in the PDF document.
List<Annotation> annotations = _pdfViewerController.getAnnotations();

if (annotations.isNotEmpty) {
// Get the last annotation from the list.
Annotation lastAnnotation = annotations.last;

// Set the author and subject for the last annotation.
lastAnnotation.author = 'John Doe';
lastAnnotation.subject = 'Reviewed';
}
}

{% endhighlight %}
{% endtabs %}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The built-in bookmark view in the `SfPdfViewer` can be opened using the [openBoo
The following code example explains the opening of the built-in bookmark view programmatically.

{% tabs %}
{% highlight dart hl_lines="1 15" %}
{% highlight dart hl_lines="1 25" %}

final GlobalKey<SfPdfViewerState> _pdfViewerKey = GlobalKey();

Expand Down
12 changes: 6 additions & 6 deletions Document-Processing/PDF/PDF-Viewer/flutter/form-filling.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Add or edit the form data programmatically in the document using the [getFormFie

### Adding or Editing text box data

Add or edit the text of the text box programmatically by changing the [text](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfTextFormField/text.html) property.
Add or edit the text of the text box programmatically by changing the [text](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfTextFormField/text.html) property of the [PdfTextFormField](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfTextFormField-class.html).

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

### Adding or Editing checkbox data

Check or uncheck the checkbox programmatically by changing the [isChecked](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfCheckboxFormField/isChecked.html) property.
Check or uncheck the checkbox programmatically by changing the [isChecked](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfCheckboxFormField/isChecked.html) property of the [PdfCheckboxFormField](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfCheckboxFormField-class.html).

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

### Editing combo box data

Select an item from the combo box programmatically using the [selectedItem](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfComboBoxFormField/selectedItem.html) property.
Select an item from the combo box programmatically using the [selectedItem](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfComboBoxFormField/selectedItem.html) property of the [PdfComboBoxFormField](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfComboBoxFormField-class.html). The item to be selected must be one of the available [items](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfComboBoxFormField/items.html) in the [PdfComboBoxFormField](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfComboBoxFormField-class.html).

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

### Editing radio button data

Select an item from the radio buttons programmatically using the [selectedItem](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfRadioFormField/selectedItem.html) property.
Select an item from the radio buttons programmatically using the [selectedItem](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfRadioFormField/selectedItem.html) property of the [PdfRadioFormField](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfRadioFormField-class.html). The item to be selected must be one of the available [items](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfRadioFormField/items.html) in the [PdfRadioFormField](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfRadioFormField-class.html).

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

### Editing list box data

Select one or more items from the list box programmatically using the [selectedItems](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfListBoxFormField/selectedItems.html) property.
Select one or more items from the list box programmatically using the [selectedItems](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfListBoxFormField/selectedItems.html) property of the [PdfListBoxFormField](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfListBoxFormField-class.html). The selected items must be chosen from the available [items](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfListBoxFormField/items.html) in the [PdfListBoxFormField](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfListBoxFormField-class.html).

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

### Adding or Editing signature data

Add or remove the signature in a signature form field programmatically by assigning the image bytes or `null` to the [signature](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfSignatureFormField/signature.html) property.
Add or remove the signature in a signature form field programmatically by assigning the image bytes or `null` to the [signature](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfSignatureFormField/signature.html) property of the [PdfSignatureFormField](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfSignatureFormField-class.html)

{% tabs %}
{% highlight dart hl_lines="17 18 19 20 21 22" %}
Expand Down
39 changes: 39 additions & 0 deletions Document-Processing/PDF/PDF-Viewer/flutter/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,43 @@ Widget build(BuildContext context) {
{% endhighlight %}
{% endtabs %}

## Using the controller Property in SfPdfViewer

The [controller](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/SfPdfViewer/controller.html) property in the SfPdfViewer widget allows you to interact with the PDF document programmatically using the [PdfViewerController](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController-class.html). This controller provides access to various methods and properties such as [jumpToPage](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController/jumpToPage.html), [zoomLevel](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController/zoomLevel.html), [pageCount](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController/pageCount.html), and annotation management.

The following code explains how to initialize, attach, and dispose the [PdfViewerController](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController-class.html).

{% tabs %}
{% highlight dart hl_lines="1 5 10 21" %}

late PdfViewerController _pdfViewerController;

@override
initState() {
_pdfViewerController = PdfViewerController();
super.initState();
}

@override
void dispose() {
_pdfViewerController.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text('Syncfusion Flutter PdfViewer')),
body: SfPdfViewer.asset(
'assets/flutter-succinctly.pdf',
controller: _pdfViewerController,
),
),
);
}

{% endhighlight %}
{% endtabs %}

N> You can refer to our [Flutter PDF Viewer](https://www.syncfusion.com/flutter-widgets/flutter-pdf-viewer) feature tour page for its groundbreaking feature representations. You can also explore our [Flutter PDF Viewer example](https://flutter.syncfusion.com/#/pdf-viewer/getting-started), which shows you how to render and configure the PDF Viewer.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void lockUnderlineAnnotations() {

## Lock the Selected Annotation

To lock the selected annotation, access the selected annotation instance and set the `isLocked` property to true. The selected annotation instance may be obtained from the `onAnnotationSelected` callback. The following example explains locking the selected annotation in a PDF document.
To lock the selected annotation, access the selected annotation instance and set the `isLocked` property to true. The selected annotation instance may be obtained from the [onAnnotationSelected](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/SfPdfViewer/onAnnotationSelected.html) callback. The following example explains locking the selected annotation in a PDF document.

{% tabs %}
{% highlight dart %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Widget build(BuildContext context) {

## Set and Adjust the Maximum Zoom Level

The `SfPdfViewer` allows you to set and adjust the maximum zoom level for the PDF document being displayed using the `maxZoomLevel` property. The following code example explains the same.
The `SfPdfViewer` allows you to set and adjust the maximum zoom level for the PDF document being displayed using the [maxZoomLevel](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/SfPdfViewer/maxZoomLevel.html) property. The following code example explains the same.

{% tabs %}
{% highlight dart hl_lines="6" %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: post
title: Open a Document From base64 in Flutter PDF Viewer | Syncfusion
description: Learn here about opening a PDF document from memory in Syncfusion® Flutter PDF Viewer widget (SfPdfViewer).
description: Learn here about opening a PDF document from base64 string in Syncfusion® Flutter PDF Viewer widget (SfPdfViewer).
platform: flutter
control: SfPdfViewer
documentation: ug
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ documentation: ug
The [SfPdfViewer.memory](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/SfPdfViewer/SfPdfViewer.memory.html) creates a widget that displays the PDF document obtained from the [Uint8List](https://api.flutter.dev/flutter/dart-typed_data/Uint8List-class.html). The following code example explains the same.

{% tabs %}
{% highlight dart hl_lines="4 5" %}
{% highlight dart hl_lines="4" %}

@override
Widget build(BuildContext context) {
return Scaffold(
body: SfPdfViewer.memory(
bytes));
body: SfPdfViewer.memory(bytes));
}

{% endhighlight %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The `SfPdfViewer` supports the following constructor types:

## Load the Document with the Specified Page

The `SfPdfViewer` allows you to load the document with the specified page using the `initialPageNumber` property. The following code example explains the same.
The `SfPdfViewer` allows you to load the document with the specified page using the [initialPageNumber](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/SfPdfViewer/initialPageNumber.html) property. The following code example explains the same.

{% tabs %}
{% highlight dart hl_lines="6" %}
Expand Down
55 changes: 55 additions & 0 deletions Document-Processing/PDF/PDF-Viewer/flutter/page-navigation.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,61 @@ Navigate to the desired pages instantly either by using the page navigation dial

![Page navigation dialog](images/page-navigation/page_navigation_dialog.png)

N>
To use the PdfViewerController methods or access properties, the controller must be attached to the SfPdfViewer widget using the [controller](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/SfPdfViewer/controller.html) parameter.

## Obtain the total page count and the current page number

The [pageCount](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController/pageCount.html) property returns the total number of pages in a PDF document. And the [pageNumber](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController/pageNumber.html) property returns the current page number displayed in the PDF Viewer.

{% tabs %}
{% highlight dart hl_lines="34 35" %}

late PdfViewerController _pdfViewerController;
int _pageNumber = 0;
int _pageCount = 0;

@override
initState() {
_pdfViewerController = PdfViewerController();
super.initState();
}

@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Syncfusion Flutter PdfViewer'),
actions: <Widget>[
SizedBox(
width: 100,
height: 50,
child: TextField(
decoration: InputDecoration(
labelText: '$_pageNumber / $_pageCount',
),
),
),
],
),
body: SfPdfViewer.network(
'https://cdn.syncfusion.com/content/PDFViewer/flutter-succinctly.pdf',
controller: _pdfViewerController,
onDocumentLoaded: (PdfDocumentLoadedDetails details) {
setState(() {
_pageNumber = _pdfViewerController.pageNumber;
_pageCount = _pdfViewerController.pageCount;
});
},
),
),
);
}

{% endhighlight %}
{% endtabs %}

## Navigate to the Desired Page Programmatically

The [jumpToPage](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController/jumpToPage.html) controller method helps you to navigate to the specified page number in a PDF document. The following code example explains the same.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ control: SfPdfViewer
documentation: ug
---

# Select and Deselect Annotations in Flutter PDF Viewer Widget (SfPdfViewer)
# Select and Deselect Annotations in Flutter PDF Viewer (SfPdfViewer)

This section will go through the various functions available in the `SfPdfViewer` for selecting and deselecting annotations in a PDF document.

Expand Down Expand Up @@ -63,7 +63,12 @@ Widget build(BuildContext context) {

### Customizing Selector Appearance

The `annotationSettings` property of `PdfViewerController` allows you to customize the default selector color. The following example explains how to customize the selector color for locked and unlocked annotations.
The [selector](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfAnnotationSettings/selector.html) property of the [annotationSettings](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController/annotationSettings.html) allows you to customize the annotation selector color.

* [color](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfAnnotationSelectorSettings/color.html) - Specifies the selector color when the selected annotation is not locked.
* [lockedColor](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfAnnotationSelectorSettings/lockedColor.html) - Specifies the selector color when the selected annotation is locked.

The following example explains how to customize the selector color for locked and unlocked annotations.

{% tabs %}
{% highlight dart %}
Expand Down Expand Up @@ -102,7 +107,7 @@ void deselectAnnotation(Annotation selectedAnnotation) {

### Annotation Deselected Callback

The callback provided to the `onAnnotationDeselected` property is triggered when an annotation is deselected interactively or programmatically. The following code sample explains how to use this callback.
The callback provided to the [onAnnotationDeselected](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/SfPdfViewer/onAnnotationDeselected.html) property is triggered when an annotation is deselected interactively or programmatically. The following code sample explains how to use this callback.

{% tabs %}
{% highlight dart hl_lines="7 8 9 10" %}
Expand Down
Loading