Skip to content

DOCINFRA-2341_merged_using_automation #873

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

Merged
merged 29 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c0fc43c
885092: Resolve the URL errors in document processing.
Sri-hari-haran-g May 7, 2024
f8e2b84
Merge pull request #852 from Syncfusion-Content/hotfix/hotfix-v25.2.3
SyncfusionBuild May 10, 2024
cba2d8c
Merge pull request #853 from Syncfusion-Content/hotfix/hotfix-v25.2.3
SyncfusionBuild May 13, 2024
05519ad
885092: Resolve the feedback.
Sri-hari-haran-g May 14, 2024
21befff
885092: Update proper URL for PDF tables page.
Sri-hari-haran-g May 14, 2024
af44e7a
885092: Resolve the feedback.
Sri-hari-haran-g May 14, 2024
67ca8f7
Merge pull request #848 from syncfusion-content/885092_ug
chinnumuniyappan May 14, 2024
640f6c1
FLUT-869469-[bug][flutter]: Modified version
May 22, 2024
3b04d07
Merge pull request #857 from syncfusion-content/FLUT-869469-Update-la…
May 22, 2024
0951194
Merge pull request #858 from Syncfusion-Content/hotfix/hotfix-v25.2.3
SyncfusionBuild May 22, 2024
2f1280f
FLUT-879690-[others][flutter]: Added user guidelines for roc and wma …
natrayansf May 28, 2024
399e562
FLUT-879690-[others][flutter]: Resolved warning issue in the indicators
natrayansf May 28, 2024
693605f
FLUT-879690-[others][flutter]: Resolved warning issue in the indicators
natrayansf May 28, 2024
d23acc9
FLUT-6668-[feature]: Added mappers codes
natrayansf May 28, 2024
a936b3d
FLUT-879690-[others][flutter]: Modified roc name
natrayansf May 28, 2024
d0e4d15
Merge pull request #866 from Syncfusion-Content/hotfix/hotfix-v25.2.3
SyncfusionBuild May 30, 2024
6ec8c9e
Merge pull request #868 from Syncfusion-Content/hotfix/hotfix-v25.2.3
SyncfusionBuild Jun 1, 2024
d7d0539
FLUT-879690-[others][flutter]: Modified demo
natrayansf Jun 3, 2024
c7961ba
Merge branch 'development' of https://github.com/syncfusion-content/f…
natrayansf Jun 3, 2024
6733cf2
FLUT-879690-[others][flutter]: Modified demo
natrayansf Jun 3, 2024
9fee249
FLUT-879690-[others][flutter]: Modified demo
natrayansf Jun 3, 2024
dcf787e
Merge pull request #863 from syncfusion-content/FLUT-879690-New-indic…
Jun 3, 2024
ba1bc75
Merge pull request #870 from Syncfusion-Content/hotfix/hotfix-v25.2.3
SyncfusionBuild Jun 4, 2024
7e69473
FLUT-886427: Add canShowTextSelectionMenu content on PDF viewer
immankumarsync Jun 5, 2024
51ccde6
Merge branch 'development' of https://github.com/syncfusion-content/f…
immankumarsync Jun 5, 2024
98bdc3e
FLUT-886427: Add canShowTextSelectionMenu content on PDF viewer
immankumarsync Jun 5, 2024
ad4cb71
FLUT-886427: Add canShowTextSelectionMenu content on PDF viewer
immankumarsync Jun 5, 2024
2c24c17
Added the release notes MD file and corresponding node entry in the T…
DeepakRajSundar Jun 6, 2024
7675d8e
Merge pull request #871 from syncfusion-content/FLUT-886427-pdfviewer
Deepak1799 Jun 6, 2024
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
16 changes: 16 additions & 0 deletions Flutter/Release-notes/v26.1.35.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: Essential Studio for Flutter 2024 Volume 2 Main Release Release Notes
description: Essential Studio for Flutter 2024 Volume 2 Main Release Release Notes
platform: flutter
documentation: ug
---

# Essential Studio for Flutter Release Notes

{% include release-info.html date="June 11, 2024" version="v26.1.35" %}

{% directory path: _includes/release-notes/v26.1.35 %}

{% include {{file.url}} %}

{% enddirectory %}
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.
171 changes: 144 additions & 27 deletions Flutter/cartesian-charts/technical-indicators.md

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions Flutter/pdf-viewer/add-remove-modify-annotations.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
layout: post
title: Add, Remove, and Edit Annotations in Flutter PDF Viewer widget | Syncfusion
title: Add, Remove, and Edit Annotations in Flutter PDF Viewer | Syncfusion
description: Learn here all about adding, removing, and editing annotations in a PDF document using the Syncfusion Flutter PDF Viewer (SfPdfViewer) widget and more.
platform: Flutter
platform: flutter
control: SfPdfViewer
documentation: ug
---

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

This section will go through the various functions available in the `SfPdfViewer` for adding, removing, and editing annotations in a PDF document.

Expand All @@ -17,7 +17,7 @@ This section will go through how to add annotations to a PDF document programmat

### 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` 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`. 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 Expand Up @@ -161,7 +161,7 @@ void editAnnotation() {

### Annotation edited callback

The callback provided to the property is triggered when an annotation is edited in the PDF document. The following code sample explains how to use this callback.
The callback provided to the [onAnnotationEdited](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/SfPdfViewer/onAnnotationEdited.html) property is triggered when an annotation is edited in the PDF document. The following code sample explains how to use this callback.

{% tabs %}
{% highlight dart hl_lines="7 8 9 10" %}
Expand Down
202 changes: 161 additions & 41 deletions Flutter/pdf-viewer/text-selection.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
layout: post
title: Text selection in Flutter PDF Viewer widget | Syncfusion
description: Learn here all about text selection feature of Syncfusion Flutter PDF Viewer (SfPdfViewer) widget and more.
platform: Flutter
platform: flutter
control: SfPdfViewer
documentation: ug
---
Expand Down Expand Up @@ -74,6 +74,28 @@ class _HomePageState extends State<HomePage> {
{% endhighlight %}
{% endtabs %}

## Customize the visibility of the text selection context menu

The `canShowTextSelectionMenu` property allows the user to customize the visibility of the built-in text selection context menu. You can assign `false` to this property to disable the text selection context menu. The following code example explains how to disable the built-in text selection context menu in the PDF viewer.

{% tabs %}
{% highlight dart hl_lines="7" %}

@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
child: SfPdfViewer.network(
'https://cdn.syncfusion.com/content/PDFViewer/encrypted.pdf',
canShowTextSelectionMenu: false,
),
),
);
}

{% endhighlight %}
{% endtabs %}

## Callbacks

The `SfPdfViewer` text selection supports the [PdfTextSelectionChangedCallback](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfTextSelectionChangedCallback.html) to notify the text selection changes.
Expand Down Expand Up @@ -104,7 +126,7 @@ Widget build(BuildContext context) {
{% endhighlight %}
{% endtabs %}

## How to get the seleted text lines in the PDF viewer?
## How to get the selected text lines in the PDF viewer?

Using the [getSelectedTextLines](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/SfPdfViewerState/getSelectedTextLines.html) method, you can get the selected text lines in the PDF viewer. The following code example explains the same.

Expand Down Expand Up @@ -147,11 +169,16 @@ Widget build(BuildContext context) {
{% endhighlight %}
{% endtabs %}

## How to create and display a customized text selection context menu with a Copy option to retrieve the selected text?
## How to create and display a customized text selection context menu with copy and text markup options to retrieve the selected text?

With the options available in the `SfPdfViewer` text selection, you can easily create and display a customized text selection context menu with the **Copy** option and perform an operation for the same. The following code example explains the same.
With the options available in `SfPdfViewer` text selection, you can easily create and display a customized text selection context menu with various options such as **Copy, Highlight, Underline, Strikethrough, and Squiggly**, and perform operations with them. The following code example explains how to implement this functionality.

In this example, we have used the [OverlayEntry](https://api.flutter.dev/flutter/widgets/OverlayEntry-class.html) widget to create the customized context menu and have added a simple button (for the Copy option) as a child to it. Whenever this Copy option is pressed, the selected text will be copied to the clipboard and the selection will be cleared. The selected text value is retrieved from the [onTextSelectionChanged](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/SfPdfViewer/onTextSelectionChanged.html) callback details and we have called the context menu displaying method within this callback implementation. The text selection gets cleared after the Copy operation by calling the [clearSelection](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController/clearSelection.html) controller method.
In this example, we use the [OverlayEntry](https://api.flutter.dev/flutter/widgets/OverlayEntry-class.html) widget to create the customized context menu and add buttons for various options, such as Copy, Highlight, Underline, Strikethrough, and Squiggly. We are calling the method to display the customized context menu in the [onTextSelectionChanged](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/SfPdfViewer/onTextSelectionChanged.html) callback. Whenever one of these options is pressed, the corresponding action is performed on the selected text.

* For the copy operation, the selected text value is retrieved from the'selectedText` property of the [onTextSelectionChanged](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/SfPdfViewer/onTextSelectionChanged.html) callback details. We then copy the text to the clipboard using the [Clipboard.setData](https://api.flutter.dev/flutter/services/Clipboard/setData.html) method.
The text selection is cleared after the Copy operation by calling the [clearSelection](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController/clearSelection.html) controller method.

* For the text markup options, we retrieve the selected text lines using the [getSelectedTextLines](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/SfPdfViewerState/getSelectedTextLines.html) method and add the respective annotations using the [addAnnotation](https://pub.dev/documentation/syncfusion_flutter_pdfviewer/latest/pdfviewer/PdfViewerController/addAnnotation.html) method on the `PdfViewerController`.

{% tabs %}
{% highlight Dart %}
Expand All @@ -176,58 +203,151 @@ class HomePage extends StatefulWidget {
class _HomePageState extends State<HomePage> {
late PdfViewerController _pdfViewerController;
OverlayEntry? _overlayEntry;
final GlobalKey<SfPdfViewerState> _pdfViewerKey = GlobalKey();

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

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Syncfusion Flutter PDF Viewer'),
),
body: SfPdfViewer.network(
'https://cdn.syncfusion.com/content/PDFViewer/flutter-succinctly.pdf',
onTextSelectionChanged: (PdfTextSelectionChangedDetails details) {
if (details.selectedText == null && _overlayEntry != null) {
_overlayEntry!.remove();
_overlayEntry = null;
} else if (details.selectedText != null && _overlayEntry == null) {
_showContextMenu(context, details);
}
},
controller: _pdfViewerController,
canShowTextSelectionMenu: false,
),
);
}

void _showContextMenu(
BuildContext context, PdfTextSelectionChangedDetails details) {
const double height = 250;
const double width = 150;
final OverlayState overlayState = Overlay.of(context);
final Size screenSize = MediaQuery.of(context).size;

double top = details.globalSelectedRegion!.top >= screenSize.height / 2
? details.globalSelectedRegion!.top - height - 10
: details.globalSelectedRegion!.bottom + 20;
top = top < 0 ? 20 : top;
top = top + height > screenSize.height
? screenSize.height - height - 10
: top;

double left = details.globalSelectedRegion!.bottomLeft.dx;
left = left < 0 ? 10 : left;
left =
left + width > screenSize.width ? screenSize.width - width - 10 : left;
_overlayEntry = OverlayEntry(
builder: (context) => Positioned(
top: details.globalSelectedRegion!.center.dy - 55,
left: details.globalSelectedRegion!.bottomLeft.dx,
child: ElevatedButton(
onPressed: () {
if (details.selectedText != null) {
Clipboard.setData(ClipboardData(text: details.selectedText!));
print('Text copied to clipboard: ${details.selectedText}');
_pdfViewerController.clearSelection();
}
},
style: ButtonStyle(
shape: MaterialStateProperty.all(RoundedRectangleBorder(
borderRadius: BorderRadius.circular(2),
)),
builder: (BuildContext context) => Positioned(
top: top,
left: left,
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(4),
boxShadow: const <BoxShadow>[
BoxShadow(
color: Colors.black26,
blurRadius: 4,
offset: Offset(2, 2),
),
],
),
constraints:
const BoxConstraints.tightFor(width: width, height: height),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
TextButton(
onPressed: () {
if (details.selectedText != null) {
Clipboard.setData(
ClipboardData(text: details.selectedText!));
print('Text copied to clipboard: ${details.selectedText}');
_pdfViewerController.clearSelection();
}
},
child: const Text('Copy', style: TextStyle(fontSize: 15)),
),
TextButton(
onPressed: () {
final List<PdfTextLine>? textLines =
_pdfViewerKey.currentState?.getSelectedTextLines();
if (textLines != null && textLines.isNotEmpty) {
final HighlightAnnotation highlightAnnotation =
HighlightAnnotation(
textBoundsCollection: textLines,
);
_pdfViewerController.addAnnotation(highlightAnnotation);
}
},
child: const Text('Highlight', style: TextStyle(fontSize: 15)),
),
TextButton(
onPressed: () {
final List<PdfTextLine>? textLines =
_pdfViewerKey.currentState?.getSelectedTextLines();
if (textLines != null && textLines.isNotEmpty) {
final UnderlineAnnotation underLineAnnotation =
UnderlineAnnotation(
textBoundsCollection: textLines,
);
_pdfViewerController.addAnnotation(underLineAnnotation);
}
},
child: const Text('Underline', style: TextStyle(fontSize: 15)),
),
TextButton(
onPressed: () {
final List<PdfTextLine>? textLines =
_pdfViewerKey.currentState?.getSelectedTextLines();
if (textLines != null && textLines.isNotEmpty) {
final StrikethroughAnnotation strikethroughAnnotation =
StrikethroughAnnotation(
textBoundsCollection: textLines,
);
_pdfViewerController.addAnnotation(strikethroughAnnotation);
}
},
child:
const Text('Strikethrough', style: TextStyle(fontSize: 15)),
),
TextButton(
onPressed: () {
final List<PdfTextLine>? textLines =
_pdfViewerKey.currentState?.getSelectedTextLines();
if (textLines != null && textLines.isNotEmpty) {
final SquigglyAnnotation squigglyAnnotation =
SquigglyAnnotation(
textBoundsCollection: textLines,
);
_pdfViewerController.addAnnotation(squigglyAnnotation);
}
},
child: const Text('Squiggly', style: TextStyle(fontSize: 15)),
),
],
),
child: const Text('Copy', style: TextStyle(fontSize: 17)),
),
),
);
overlayState.insert(_overlayEntry!);
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Syncfusion Flutter PDF Viewer'),
),
body: SfPdfViewer.network(
'https://cdn.syncfusion.com/content/PDFViewer/flutter-succinctly.pdf',
onTextSelectionChanged: (PdfTextSelectionChangedDetails details) {
if (details.selectedText == null && _overlayEntry != null) {
_overlayEntry!.remove();
_overlayEntry = null;
} else if (details.selectedText != null && _overlayEntry == null) {
_showContextMenu(context, details);
}
},
controller: _pdfViewerController,
));
}
}

{% endhighlight %}
Expand Down
Loading