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
Juan Delgado
2022-11-27 23:33:31 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2022-11-27 18:33:31 -0400
Commit
8da604930b1e97cc88b26907d44f15bea13a0e29
8da60493
1 parent
b525bd4d
Adds example on how to add an SVG from embedded assets (#1200)
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
pdf/README.md
pdf/README.md
View file @
8da6049
...
...
@@ -83,6 +83,21 @@ pdf.addPage(pw.Page(build: (pw.Context context) {
}));
// Page
```
To load an SVG from assets:
```
dart
String
svgRaw
=
await
rootBundle
.
loadString
(
'assets/path/to/file.svg'
);
final
svgImage
=
pw
.
SvgImage
(
svg:
svgRaw
);
pdf
.
addPage
(
pw
.
Page
(
build:
(
pw
.
Context
context
)
{
return
pw
.
Center
(
child:
svgImage
,
);
// Center
}));
// Page
```
To use a TrueType font:
```
dart
...
...
Please
register
or
login
to post a comment