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-07-16 17:11:22 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ea9884227760f3e1dde3f696d0512f3039e4498c
ea988422
1 parent
2ef10e16
Prepare publishing
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
2 deletions
README.md
pubspec.yaml
test/example.dart
README.md
View file @
ea98842
# Pdf creation library for dart / flutter
Example:
```
dart
final
pdf
=
new
PDFDocument
();
final
page
=
new
PDFPage
(
pdf
,
pageFormat:
new
PDFPageFormat
(
PDFPageFormat
.
LETTER
));
final
g
=
page
.
getGraphics
();
final
font
=
new
PDFFont
(
pdf
);
g
.
setColor
(
new
PDFColor
(
0.0
,
1.0
,
1.0
));
g
.
drawRect
(
50.0
,
30.0
,
100.0
,
50.0
);
g
.
fillPath
();
g
.
setColor
(
new
PDFColor
(
0.3
,
0.3
,
0.3
));
g
.
drawString
(
font
,
12.0
,
"Hello World!"
,
50.0
,
300.0
);
var
file
=
new
File
(
'file.pdf'
);
file
.
writeAsBytesSync
(
pdf
.
save
());
```
...
...
pubspec.yaml
View file @
ea98842
...
...
@@ -4,9 +4,13 @@ description: A pdf producer for Dart
homepage
:
https://github.com/davbfr/dart_pdf
version
:
1.0.0
environment
:
sdk
:
"
>=1.8.0
<2.0.0"
dependencies
:
meta
:
"
^1.1.5"
ttf_parser
:
"
^1.0.0"
vector_math
:
vector_math
:
"
^2.0.7"
dev_dependencies
:
test
:
"
^0.12.32+1"
\ No newline at end of file
test
:
any
...
...
test/example.dart
0 → 100644
View file @
ea98842
import
'dart:io'
;
import
'package:pdf/pdf.dart'
;
void
main
(
)
{
final
pdf
=
new
PDFDocument
();
final
page
=
new
PDFPage
(
pdf
,
pageFormat:
new
PDFPageFormat
(
PDFPageFormat
.
LETTER
));
final
g
=
page
.
getGraphics
();
final
font
=
new
PDFFont
(
pdf
);
g
.
setColor
(
new
PDFColor
(
0.0
,
1.0
,
1.0
));
g
.
drawRect
(
50.0
,
30.0
,
100.0
,
50.0
);
g
.
fillPath
();
g
.
setColor
(
new
PDFColor
(
0.3
,
0.3
,
0.3
));
g
.
drawString
(
font
,
12.0
,
"Hello World!"
,
50.0
,
300.0
);
var
file
=
new
File
(
'file.pdf'
);
file
.
writeAsBytesSync
(
pdf
.
save
());
}
...
...
Please
register
or
login
to post a comment