David PHAM-VAN

Fix README

@@ -2,8 +2,8 @@ @@ -2,8 +2,8 @@
2 2
3 This library is divided into two parts: 3 This library is divided into two parts:
4 4
5 -* a low-level Pdf creation library that takes care of the pdf bits generation.  
6 -* a Widgets system similar to Flutter's, for easy high-level Pdf creation. 5 +- a low-level Pdf creation library that takes care of the pdf bits generation.
  6 +- a Widgets system similar to Flutter's, for easy high-level Pdf creation.
7 7
8 It can create a full multi-pages document with graphics, 8 It can create a full multi-pages document with graphics,
9 images, and text using TrueType fonts. With the ease of use you already know. 9 images, and text using TrueType fonts. With the ease of use you already know.
@@ -15,7 +15,7 @@ See an interactive demo here: <https://davbfr.github.io/dart_pdf/>. @@ -15,7 +15,7 @@ See an interactive demo here: <https://davbfr.github.io/dart_pdf/>.
15 </a> 15 </a>
16 16
17 The source code for a full demo that can run on any Flutter target, and how to build, 17 The source code for a full demo that can run on any Flutter target, and how to build,
18 -it can be found here: 18 +it can be found here:
19 <https://github.com/DavBfr/dart_pdf/tree/master/demo/> 19 <https://github.com/DavBfr/dart_pdf/tree/master/demo/>
20 20
21 Use the `printing` package <https://pub.dev/packages/printing> 21 Use the `printing` package <https://pub.dev/packages/printing>
@@ -23,8 +23,8 @@ for full flutter print and share operation. @@ -23,8 +23,8 @@ for full flutter print and share operation.
23 23
24 The coordinate system is using the internal Pdf unit: 24 The coordinate system is using the internal Pdf unit:
25 25
26 -* 1.0 is defined as 1 / 72.0 inch  
27 -* you can use the constants for centimeters, millimeters, and inch defined in PdfPageFormat 26 +- 1.0 is defined as 1 / 72.0 inch
  27 +- you can use the constants for centimeters, millimeters, and inch defined in PdfPageFormat
28 28
29 [![Buy Me A Coffee](https://bmc-cdn.nyc3.digitaloceanspaces.com/BMC-button-images/custom_images/orange_img.png "Buy Me A Coffee")](https://www.buymeacoffee.com/JORBmbw9h "Buy Me A Coffee") 29 [![Buy Me A Coffee](https://bmc-cdn.nyc3.digitaloceanspaces.com/BMC-button-images/custom_images/orange_img.png "Buy Me A Coffee")](https://www.buymeacoffee.com/JORBmbw9h "Buy Me A Coffee")
30 30
@@ -83,11 +83,14 @@ pdf.addPage(pw.Page(build: (pw.Context context) { @@ -83,11 +83,14 @@ pdf.addPage(pw.Page(build: (pw.Context context) {
83 })); // Page 83 })); // Page
84 ``` 84 ```
85 85
86 -To load an SVG from assets: 86 +To load an SVG:
87 87
88 ```dart 88 ```dart
89 -String svgRaw =  
90 - await rootBundle.loadString('assets/path/to/file.svg'); 89 +String svgRaw = '''
  90 +<svg viewBox="0 0 50 50" xmlns="http://www.w3.org/2000/svg">
  91 + <ellipse style="fill: grey; stroke: black;" cx="25" cy="25" rx="20" ry="20"></ellipse>
  92 +</svg>
  93 +''';
91 94
92 final svgImage = pw.SvgImage(svg: svgRaw); 95 final svgImage = pw.SvgImage(svg: svgRaw);
93 96
@@ -98,6 +101,8 @@ pdf.addPage(pw.Page(build: (pw.Context context) { @@ -98,6 +101,8 @@ pdf.addPage(pw.Page(build: (pw.Context context) {
98 })); // Page 101 })); // Page
99 ``` 102 ```
100 103
  104 +To load the SVG from a Flutter asset, use `await rootBundle.loadString('assets/file.svg')`
  105 +
101 To use a TrueType font: 106 To use a TrueType font:
102 107
103 ```dart 108 ```dart