Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
dart_pdf
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
David PHAM-VAN
2018-08-15 10:10:38 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1fc9ebffcf17e3625d9ead36579b3bdfa8bd837e
1fc9ebff
1 parent
709143aa
Update README
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
6 deletions
README.md
pdf/CHANGELOG.md
pdf/README.md
printing/CHANGELOG.md
printing/README.md
README.md
View file @
1fc9ebf
...
...
@@ -3,3 +3,5 @@
This set of plugin allows Flutter apps to generate and print pdf files to device printer.
This plugin works for iOS and Android.
*
dart pdf:
<https://pub.dartlang.org/packages/pdf>
*
flutter printing:
<https://pub.dartlang.org/packages/printing>
...
...
pdf/CHANGELOG.md
View file @
1fc9ebf
# 1.0.4
*
Updated homepage
*
Update source formatting
*
Update README
# 1.0.3
*
Remove dependency to ttf_parser
...
...
pdf/README.md
View file @
1fc9ebf
...
...
@@ -4,6 +4,9 @@ This is a low-level Pdf creation library.
It can create a full multi-pages document with graphics,
images and text using TrueType fonts.
> Use `printing` package <https://pub.dartlang.org/packages/printing>
> for full flutter print and share operation.
The coordinate system is using the internal Pdf system:
*
(0.0, 0.0) is bottom-left
*
1.0 is defined as 1 / 72.0 inch
...
...
@@ -27,7 +30,7 @@ var file = new File('file.pdf');
file
.
writeAsBytesSync
(
pdf
.
save
());
```
To load an image it is possible to use the dart library
`image`
To load an image it is possible to use the dart library
[
image
](
https://pub.dartlang.org/packages/image
)
:
```
dart
Image
image
=
decodeImage
(
new
Io
.
File
(
'test.webp'
).
readAsBytesSync
());
...
...
printing/CHANGELOG.md
View file @
1fc9ebf
# 1.0.3
*
Update source formatting
*
Update README
# 1.0.2
*
Add License file
...
...
printing/README.md
View file @
1fc9ebf
# Printing
Plugin that allows Flutter apps to generate and print documents to android or ios compatible printers
Plugin that allows Flutter apps to generate and print
documents to android or ios compatible printers
## Getting Started
See the example on how to use the plugin.
For help getting started with Flutter, view our online
[
documentation
](
https://flutter.io/
)
.
> This plugin uses the `pdf` package <https://pub.dartlang.org/packages/pdf>
> for pdf creation. Please refer to <https://pub.dartlang.org/documentation/pdf/latest/>
> for documentation.
For help on editing plugin code, view the
[
documentation
](
https://flutter.io/developing-packages/#edit-plugin-package
)
.
To load an image it is possible to use
[
Image.toByteData
](
https://docs.flutter.io/flutter/dart-ui/Image/toByteData.html
)
:
```
dart
var
Image
im
;
var
bytes
=
await
im
.
toByteData
(
format:
ui
.
ImageByteFormat
.
rawRgba
);
PDFImage
image
=
PDFImage
(
pdf
,
image:
bytes
.
buffer
.
asUint8List
(),
width:
im
.
width
,
height:
im
.
height
);
g
.
drawImage
(
image
,
100.0
,
100.0
,
80.0
);
```
To use a TrueType font from a flutter bundle:
```
dart
var
font
=
await
rootBundle
.
load
(
"assets/open-sans.ttf"
);
PDFTTFFont
ttf
=
new
PDFTTFFont
(
pdf
,
font
);
g
.
setColor
(
new
PDFColor
(
0.3
,
0.3
,
0.3
));
g
.
drawString
(
ttf
,
20.0
,
"Dart is awesome"
,
50.0
,
30.0
);
```
...
...
Please
register
or
login
to post a comment