You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+51-7Lines changed: 51 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,19 @@
1
1
# HTMLtoPDFWidgets
2
2
3
3
4
-
HTMLtoPDFWidgets is a Flutter package that allows you to convert HTML content into PDF documents with support for various Rich Text Editor formats. With this package, you can effortlessly generate PDF files that include elements such as lists, paragraphs, images, quotes, and headings.
4
+
HTMLtoPDFWidgets is a Flutter package that allows you to convert HTML and Markdown content into PDF documents with support for various Rich Text Editor formats. With this package, you can effortlessly generate PDF files that include elements such as lists, paragraphs, images, quotes, and headings.
5
+
6
+
## Help Maintenance
7
+
8
+
I've been maintaining quite many repos these days and burning out slowly. If you could help me cheer up, buying me a cup of coffee will make my life really happy and get much energy out of it.
9
+
10
+
<ahref="https://www.buymeacoffee.com/alihassan13"target="_blank"><imgsrc="https://www.buymeacoffee.com/assets/img/custom_images/purple_img.png"alt="Buy Me A Coffee"style="height: auto!important;width: auto!important;" ></a>
5
11
6
12
## Features
7
13
8
14
- Convert HTML content to PDF documents in Flutter apps
9
-
- Support for Rich Text Editor formats
15
+
- Support for Markdown to PDF conversion
16
+
- Rich Text Editor formatting support
10
17
- Seamless integration with your Flutter project
11
18
- Lightweight and easy to use
12
19
@@ -16,7 +23,7 @@ Add the following dependency to your `pubspec.yaml` file:
16
23
17
24
```yaml
18
25
dependencies:
19
-
htmltopdfwidgets: ^0.0.9+1
26
+
htmltopdfwidgets: ^1.0.5
20
27
```
21
28
22
29
## Usage
@@ -55,6 +62,47 @@ final htmlContent = '''
55
62
}));
56
63
await file.writeAsBytes(await newpdf.save());
57
64
```
65
+
2. Converting Markdown to PDF:
66
+
67
+
```dart
68
+
final markDown = '''
69
+
# Basic Markdown Demo
70
+
---
71
+
The Basic Markdown Demo shows the effect of the four Markdown extension sets
72
+
on formatting basic and extended Markdown tags.
73
+
74
+
## Overview
75
+
76
+
The Dart [markdown](https://pub.dev/packages/markdown) package parses Markdown
77
+
into HTML. The flutter_markdown package builds on this package using the
78
+
abstract syntax tree generated by the parser to make a tree of widgets instead
79
+
of HTML elements.
80
+
81
+
The markdown package supports the basic block and inline Markdown syntax
82
+
specified in the original Markdown implementation as well as a few Markdown
83
+
extensions. The markdown package uses extension sets to make extension
84
+
management easy. There are four pre-defined extension sets; none, Common Mark,
85
+
GitHub Flavored, and GitHub Web. The default extension set used by the
86
+
flutter_markdown package is GitHub Flavored.
87
+
88
+
The Basic Markdown Demo shows the effect each of the pre-defined extension sets
89
+
has on a test Markdown document with basic and extended Markdown tags. Use the
90
+
Extension Set dropdown menu to select an extension set and view the Markdown
91
+
widget's output.
92
+
93
+
## Comments
94
+
95
+
Since GitHub Flavored is the default extension set, it is the initial setting
96
+
for the formatted Markdown view in the demo.
97
+
''';
98
+
99
+
final List<Widget> markdownWidgets = await HTMLToPdf().convertMarkdown(markDown);
For more details on usage and available options, please refer to the [API documentation](https://pub.dev/documentation/htmltopdfwidgets/latest).
60
108
@@ -81,9 +129,5 @@ I use their Html To Document plugin as reference
81
129
82
130
Happy PDF generation with HTMLtoPDFWidgets in your Flutter apps!
83
131
84
-
## Help Maintenance
85
132
86
-
I've been maintaining quite many repos these days and burning out slowly. If you could help me cheer up, buying me a cup of coffee will make my life really happy and get much energy out of it.
87
-
88
-
<ahref="https://www.buymeacoffee.com/alihassan13"target="_blank"><imgsrc="https://www.buymeacoffee.com/assets/img/custom_images/purple_img.png"alt="Buy Me A Coffee"style="height: auto!important;width: auto!important;" ></a>
0 commit comments