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
2021-12-31 13:41:59 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
faf3091c89b29c83e783354f2b6a40523180624d
faf3091c
1 parent
a80a7c99
Update README
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
pdf/README.md
pdf/README.md
View file @
faf3091
...
...
@@ -67,6 +67,18 @@ pdf.addPage(pw.Page(build: (pw.Context context) {
}));
// Page
```
To load an image from the network using the
`printing`
package:
```
dart
final
image
=
await
networkImage
(
'https://www.nfet.net/nfet.jpg'
);
pdf
.
addPage
(
pw
.
Page
(
build:
(
pw
.
Context
context
)
{
return
pw
.
Center
(
child:
pw
.
Image
(
image
),
);
// Center
}));
// Page
```
To use a TrueType font:
```
dart
...
...
@@ -82,6 +94,40 @@ pdf.addPage(pw.Page(
}));
// Page
```
Or using the
`printing` package's `PdfGoogleFonts`
:
```
dart
final
font
=
await
PdfGoogleFonts
.
nunitoExtraLight
();
pdf
.
addPage
(
pw
.
Page
(
pageFormat:
PdfPageFormat
.
a4
,
build:
(
pw
.
Context
context
)
{
return
pw
.
Center
(
child:
pw
.
Text
(
'Hello World'
,
style:
pw
.
TextStyle
(
font:
font
,
fontSize:
40
)),
);
// Center
}));
// Page
```
To display emojis:
```
dart
final
emoji
=
await
PdfGoogleFonts
.
notoColorEmoji
();
pdf
.
addPage
(
pw
.
Page
(
pageFormat:
PdfPageFormat
.
a4
,
build:
(
pw
.
Context
context
)
{
return
pw
.
Center
(
child:
pw
.
Text
(
'Hello 🐒💁👌🎍😍🦊👨 world!'
,
style:
pw
.
TextStyle
(
fontFallback:
[
emoji
],
fontSize:
25
,
),
),
);
// Center
}));
// Page
```
To save the pdf file:
```
dart
...
...
Please
register
or
login
to post a comment