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
24 changes: 12 additions & 12 deletions Document-Processing/PDF/PDF-Library/flutter/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Check the following video to quickly get started with creating a Flutter PDF doc

## Steps to create PDF document in Flutter application

Create a simple project using the instructions given in the [`Getting Started with your first Flutter app'](https://docs.flutter.dev/get-started/test-drive#choose-your-ide) documentation.
Create a simple project using the instructions given in the [`Getting Started with your first Flutter app`](https://docs.flutter.dev/get-started/test-drive#choose-your-ide) documentation.

**Add dependency**

Expand All @@ -38,9 +38,9 @@ N> Here **xx.x.xx** denotes the current version of [`Syncfusion Flutter PDF`](ht
Run the following command to get the required packages.

{% tabs %}
{% highlight dart tabtitle="dart" %}
{% highlight powershell tabtitle="POWERSHELL" %}

$ flutter pub get
flutter pub get

{% endhighlight %}
{% endtabs %}
Expand All @@ -67,8 +67,8 @@ Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: TextButton(
onPressed: _createPDF,
child: Text('Create PDF')
onPressed: _createPDF,
child: Text('Create PDF'),
),
),
);
Expand Down Expand Up @@ -113,7 +113,7 @@ You can save and open a PDF document in desktop by using the following steps:
Configure and enable the desktop support to run the app.

{% tabs %}
{% highlight dart tabtitle="dart" %}
{% highlight dart tabtitle="dart" %}

flutter config --enable-<platform>-desktop

Expand All @@ -129,10 +129,10 @@ Here you can get more details about [`How to add desktop support in the app`](ht
Add the following packages to your pub spec file.

{% tabs %}
{% highlight dart tabtitle="dart" %}
{% highlight dart tabtitle="dart" %}

path_provider: ^1.6.5
open_file: ^3.0.1
path_provider: ^2.0.7
open_file: ^3.2.1

{% endhighlight %}
{% endtabs %}
Expand Down Expand Up @@ -275,11 +275,11 @@ Add the following code in the header section of index.html file under the web fo

## Save and download a PDF document in WASM

step 1: Add the [web](https://pub.dev/packages/web) package as a dependency in your **pubspec.yaml** file.
**Step 1:** Add the [web](https://pub.dev/packages/web) package as a dependency in your **pubspec.yaml** file.

step 2: Create a new Dart file called **save_file_wasm.dart**.
**Step 2:** Create a new Dart file called **save_file_wasm.dart**.

step 3: Add the following code:
**Step 3:** Add the following code:

**Import package**

Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,42 @@
---
layout: post
title: Open and save PDF file in Flutter PDF library | Syncfusion
description: Learn here all about Open and save PDF file feature of Syncfusion Flutter PDF non-UI library and more.
title: Open and save a PDF file in Flutter PDF library | Syncfusion
description: Learn here all about Open and save a PDF file feature of Syncfusion Flutter PDF non-UI library and more.
platform: document-processing
control: PDF
documentation: ug
---

# Open and save PDF file in Flutter PDF
# Open and save a PDF file in Flutter PDF

## Opening an existing PDF document

You can open an existing PDF document by using the [`PdfDocument`](https://pub.dev/documentation/syncfusion_flutter_pdf/latest/pdf/PdfDocument-class.html) class. The following example shows how to load an existing document from the list of bytes.

{% tabs %}
{% highlight dart tabtitle="dart" %}

import 'dart:io';
//Opens an existing document from the list of bytes
PdfDocument document =
PdfDocument(inputBytes: File('input.pdf').readAsBytesSync());

{% endhighlight %}
{% endtabs %}

## Opening an existing PDF document from the base 64 string
## Opening an existing PDF document from the Base64 string

You can open an existing document from the base 64 string by using the [`PdfDocument`](https://pub.dev/documentation/syncfusion_flutter_pdf/latest/pdf/PdfDocument-class.html) class as shown below.
You can open an existing document from the Base64 string by using the [`PdfDocument`](https://pub.dev/documentation/syncfusion_flutter_pdf/latest/pdf/PdfDocument-class.html) class as shown below.

{% tabs %}
{% highlight dart tabtitle="dart" %}

//Opens an existing document from the base 64 string
//Opens an existing document from the Base64 string
PdfDocument document = PdfDocument.fromBase64String(
'JVBERi0xLjcNCiWDkvr+DQoxIDAgb2JqDQo8PA0KL1R5cGUgL0NhdGFsb2cNCi9QYWdlcyAyIDAgUg0KPj4NCmVuZG9iag0KMiAwIG9iag0KPDwNCi9UeXBlIC9QYWdlcw0KL0tpZHMgWzMgMCBSXQ0KL0NvdW50IDENCi9SZXNvdXJjZXMgPDw+Pg0KDQovTWVkaWFCb3ggWzAgMCA1OTUgODQyXQ0KPj4NCmVuZG9iag0KMyAwIG9iag0KPDwNCi9Db3VudCAxDQovVHlwZSAvUGFnZXMNCi9LaWRzIFs0IDAgUl0NCi9QYXJlbnQgMiAwIFINCj4+DQplbmRvYmoNCjQgMCBvYmoNCjw8DQovVHlwZSAvUGFnZQ0KL1BhcmVudCAzIDAgUg0KPj4NCmVuZG9iag0KeHJlZg0KMCA1DQowMDAwMDAwMDAwIDY1NTM1IGYNCjAwMDAwMDAwMTcgMDAwMDAgbg0KMDAwMDAwMDA3MiAwMDAwMCBuDQowMDAwMDAwMTgwIDAwMDAwIG4NCjAwMDAwMDAyNTkgMDAwMDAgbg0KdHJhaWxlcg0KPDwNCi9Sb290IDEgMCBSDQovU2l6ZSA1DQo+Pg0KDQpzdGFydHhyZWYNCjMxMg0KJSVFT0Y=');

{% endhighlight %}
{% endtabs %}

## Saving a PDF document to list of bytes
## Saving a PDF document to a list of bytes

You can save the manipulated PDF document as a list of bytes using the [`save`](https://pub.dev/documentation/syncfusion_flutter_pdf/latest/pdf/PdfDocument/save.html) method of [`PdfDocument`](https://pub.dev/documentation/syncfusion_flutter_pdf/latest/pdf/PdfDocument-class.html) class. Also, you can save the list of bytes to the file system as follows.

Expand All @@ -55,4 +54,4 @@ List<int> bytes =await document.save();
File('output.pdf').writeAsBytes(bytes);

{% endhighlight %}
{% endtabs %}
{% endtabs %}
20 changes: 10 additions & 10 deletions Document-Processing/PDF/PDF-Library/flutter/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ documentation: ug

# Flutter PDF Overview

The Syncfusion<sup>&reg;</sup> Flutter PDF is a library written natively in Dart for creating the PDF documents from scratch. The library can be used in Flutter Mobile and Web platforms without the dependency of Adobe Acrobat. The creation of PDF follows the most popular PDF 1.7 (ISO 32000-1) and latest PDF 2.0 (ISO 32000-2) specifications.
The Syncfusion<sup>&reg;</sup> Flutter PDF is a library written natively in Dart for creating PDF documents from scratch. It can be used in Flutter Mobile and Web platforms without requiring Adobe Acrobat. The creation of PDF follows the most popular PDF 1.7 (ISO 32000-1) and the latest PDF 2.0 (ISO 32000-2) specifications.

Check the following video for a quick overview of Syncfusion Flutter UI Widgets and File Format Packages.
{% youtube "https://youtu.be/FwUSJtv-3NY?si=doGR-fOkvghf-UUa" %}

## Key features of Syncfusion<sup>&reg;</sup> Flutter PDF:

* Support to create PDF files from scratch.
* Support to add text and drawing shapes.
* Support to add ordered and unordered lists.
* Support to draw raster images like JPEG and PNG formats.
* Support to add hyperlink and document link annotations.
* Support to add tables.
* Support to add headers and footers in PDF document.
* Support to add bookmarks in PDF document.
* Support to protect PDF document by encryption.
* Creates PDF files from scratch.
* Adds text and draws shapes.
* Adds ordered and unordered lists.
* Draws raster images such as JPEG and PNG formats.
* Adds hyperlink and document link annotations.
* Adds tables.
* Adds headers and footers in PDF documents.
* Adds bookmarks in PDF documents.
* Protects PDF documents with encryption.

You can get the sample from this link: [`Flutter PDF`](https://github.com/syncfusion/flutter-examples).
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ PdfPage page = document.pages.add();
//Creates a new document link annotation
PdfDocumentLinkAnnotation documentLinkAnnotation =
PdfDocumentLinkAnnotation(Rect.fromLTWH(10, 40, 30, 30),
setAppearance: true,
PdfDestination(document.pages.add(), Offset(10, 0)));
PdfDestination(document.pages.add(), Offset(10, 0)),
setAppearance: true);

//Adds this annotation the page.
page.annotations.add(documentLinkAnnotation);
Expand Down Expand Up @@ -305,7 +305,7 @@ document.dispose();

This annotation is used to navigate to a particular web URI while clicking on the link text.

The following code example explains how to add the Text Web Link annotation in a PDF document using the PdfTextWebLinkAnnotation.
The following code example explains how to add the Text Web Link annotation in a PDF document using the PdfTextWebLink.
{% tabs %}
{% highlight dart tabtitle="dart" %}

Expand Down Expand Up @@ -415,7 +415,7 @@ Pop-up annotation displays text in a pop-up window for entry and editing.

It typically does not appear alone but is associated with markup annotation, its parent annotation.

PdfPopupAnnotation is used to add pop-up annotation in a PDF document.
PdfPopupAnnotation is used to add a pop-up annotation in a PDF document.

{% tabs %}
{% highlight dart tabtitle="dart" %}
Expand Down Expand Up @@ -471,9 +471,9 @@ document.dispose();

## Flatten annotation

Annotations can be flattened by removing the existing annotation and replacing it with the graphics objects that would resemble the annotation and it cannot be edited.
Annotations can be flattened by removing the existing annotation and replacing it with graphics objects that resemble the annotation, making it non-editable.

This can be achieved by enabling the flattenAllAnnotations method . Please refer to the sample for flattening all the annotations in the PDF document.
This can be achieved by calling the flattenAllAnnotations method. Please refer to the sample for flattening all the annotations in the PDF document.

{% tabs %}
{% highlight dart tabtitle="dart" %}
Expand Down Expand Up @@ -571,7 +571,7 @@ annotation.innerColor = PdfColor(0, 255, 0);
annotation.text = 'Modified Annotation';
annotation.author = 'Syncfusion';
annotation.modifiedDate = DateTime.now();
annotation.setAppearance: true;
annotation.setAppearance = true;

//Saves the document
File('output.pdf').writeAsBytes(await document.save());
Expand Down Expand Up @@ -652,15 +652,15 @@ If set, do not display the annotation on the screens or allow the user to intera
<tr>
<td>
readOnly<br/><br/></td><td>
If set, do not allow the user to interact with annotation.<br/><br/></td></tr>
If set, do not allow the user to interact with the annotation.<br/><br/></td></tr>
<tr>
<td>
locked<br/><br/></td><td>
If set, do not allow the annotation to be deleted or its properties to be modified by the user.<br/><br/></td></tr>
<tr>
<td>
toggleNoView<br/><br/></td><td>
If set, invert the interpretation of the noView flat for certain events.<br/><br/></td></tr>
If set, invert the interpretation of the noView flag for certain events.<br/><br/></td></tr>
</tbody>
</table>

Expand Down Expand Up @@ -793,11 +793,11 @@ To export annotation data to the FDF file from the PDF document, you can use the
//Load an existing PDF document.
PdfDocument document =
PdfDocument(inputBytes: File('input.pdf').readAsBytesSync());
//Export the annotations to FDF file format
//Export the annotations to FDF file format.
List<int> bytes = document.exportAnnotation(PdfAnnotationDataFormat.fdf);
//Save the FDF file.
File('export.fdf').writeAsBytesSync(bytes);
//Dispose the document
//Dispose the document.
document.dispose();

{% endhighlight %}
Expand All @@ -815,7 +815,7 @@ To export annotation data to the XFDF file from the PDF document, you can use th
PdfDocument(inputBytes: File('input.pdf').readAsBytesSync());
//Export the annotations to XFDF file format.
List<int> bytes = document.exportAnnotation(PdfAnnotationDataFormat.xfdf);
//Save the FDF file.
//Save the XFDF file.
File('export.xfdf').writeAsBytesSync(bytes);
//Dispose the document.
document.dispose();
Expand All @@ -835,10 +835,10 @@ To export annotation data to the JSON file from the PDF document, you can use th
PdfDocument(inputBytes: File('input.pdf').readAsBytesSync());
//Export the annotations to JSON file format.
List<int> bytes = document.exportAnnotation(PdfAnnotationDataFormat.json);
//Save the FDF file.
//Save the JSON file.
File('export.json').writeAsBytesSync(bytes);
//Dispose the document.
document.dispose();

{% endhighlight %}
{% endtabs %}
{% endtabs %}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: post
title: Attachments in Flutter PDF library | Syncfusion
description: Learn here all about add, remove, and load the properties of file Attachments feature of Syncfusion Flutter PDF non-UI library and more.
description: Learn here all about add, remove, and extract the properties of file Attachments feature of Syncfusion Flutter PDF non-UI library and more.
platform: document-processing
control: PDF
documentation: ug
Expand Down Expand Up @@ -111,7 +111,7 @@ document.dispose();
{% endhighlight %}
{% endtabs %}

## Extracting and saving an attachment to the disc
## Extracting and saving an attachment to the disk

The Syncfusion<sup>&reg;</sup> Flutter PDF provides support for extracting the attachments and saving them to the disk. The following code example explains how to extract and save an attachment.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ documentation: ug

# Bookmarks in Flutter PDF

The Syncfusion<sup>&reg;</sup> Flutter PDF provides support to add [`bookmarks`](https://pub.dev/documentation/syncfusion_flutter_pdf/latest/pdf/PdfDocument/bookmarks.html) to a PDF document to navigate interactively from one part of the document to another. It provides customization such as title font, color, size and more. It also provides support to [`insert`](https://pub.dev/documentation/syncfusion_flutter_pdf/latest/pdf/PdfBookmarkBase/insert.html), [`remove`](https://pub.dev/documentation/syncfusion_flutter_pdf/latest/pdf/PdfBookmarkBase/remove.html), and modify the bookmarks in an existing PDF Document.
The Syncfusion<sup>&reg;</sup> Flutter PDF provides support to add [`bookmarks`](https://pub.dev/documentation/syncfusion_flutter_pdf/latest/pdf/PdfDocument/bookmarks.html) to a PDF document to navigate interactively from one part of the document to another. It provides customization such as title font, color, size and more. It also provides support to [`insert`](https://pub.dev/documentation/syncfusion_flutter_pdf/latest/pdf/PdfBookmarkBase/insert.html), [`remove`](https://pub.dev/documentation/syncfusion_flutter_pdf/latest/pdf/PdfBookmarkBase/remove.html), and modify the bookmarks in an existing PDF document.

## Adding bookmarks to a PDF

Expand All @@ -18,7 +18,7 @@ The [`PdfBookmarkBase`](https://pub.dev/documentation/syncfusion_flutter_pdf/lat
{% tabs %}
{% highlight dart tabtitle="dart" %}

//Create a new PDF document
//Creates a new PDF document
PdfDocument document = PdfDocument();

//Creates document bookmark
Expand All @@ -30,13 +30,13 @@ bookmark.destination = PdfDestination(document.pages.add(), Offset(100, 100));
//Sets the text style
bookmark.textStyle = [PdfTextStyle.bold];

//Sets the bookmark color(RGB)
//Sets the bookmark color (RGB)
bookmark.color = PdfColor(255, 0, 0);

//Save the document
//Saves the document
File('Output.pdf').writeAsBytes(await document.save());

//Dispose the document
//Disposes the document
document.dispose();

{% endhighlight %}
Expand All @@ -49,10 +49,10 @@ You can add a child bookmark by using the [`insert`](https://pub.dev/documentati
{% tabs %}
{% highlight dart tabtitle="dart" %}

//Create a new PDF document
//Creates a new PDF document
PdfDocument document = PdfDocument();

//Add a page
//Adds a page
PdfPage page = document.pages.add();

//Creates document bookmark
Expand All @@ -72,16 +72,16 @@ childBookmark2.textStyle = [PdfTextStyle.italic];
childBookmark1.destination = PdfDestination(page, Offset(100, 100));
childBookmark2.destination = PdfDestination(page, Offset(100, 400));

//Sets the bookmark color(RGB)
//Sets the bookmark color (RGB)
childBookmark1.color = PdfColor(0, 255, 0);
childBookmark2.color = PdfColor(0, 0, 255);

//Saves the bookmark
//Saves the document
File('Output.pdf').writeAsBytes(await document.save());

//Dispose the document
//Disposes the document
document.dispose();
{% endhighlight %}
{% endtabs %}

Expand Down Expand Up @@ -176,8 +176,7 @@ document.dispose();

## Modifying bookmarks in an existing PDF

The Syncfusion<sup>&reg;</sup>
Flutter PDF allows you to modify the [`bookmarks`](https://pub.dev/documentation/syncfusion_flutter_pdf/latest/pdf/PdfDocument/bookmarks.html) in the existing PDF document. The following modifications can be done to bookmarks in an existing document.
The Syncfusion<sup>&reg;</sup> Flutter PDF allows you to modify the [`bookmarks`](https://pub.dev/documentation/syncfusion_flutter_pdf/latest/pdf/PdfDocument/bookmarks.html) in the existing PDF document. The following modifications can be done to bookmarks in an existing document.

* Modify the bookmark style, color, title, and destination.
* Add or insert new bookmarks into the root collection.
Expand Down Expand Up @@ -217,4 +216,4 @@ File('output.pdf').writeAsBytes(await document.save());
document.dispose();

{% endhighlight %}
{% endtabs %}
{% endtabs %}
Loading