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
2020-09-09 08:35:39 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
13dcd46c79c31345f28740a4b5d2c1f9b13327fa
13dcd46c
1 parent
9549cf52
Fix readme
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
printing/README.md
test/extract_readme.dart
printing/README.md
View file @
13dcd46
...
...
@@ -141,6 +141,23 @@ and refresh.
Take a look at the
[
example tab
](
example
)
for a sample project.
Update the
`_generatePdf`
method with your design.
```
dart
Future
<
Uint8List
>
_generatePdf
(
PdfPageFormat
format
,
String
title
)
async
{
final
pdf
=
pw
.
Document
();
pdf
.
addPage
(
pw
.
Page
(
pageFormat:
format
,
build:
(
context
)
=>
pw
.
Placeholder
(),
),
);
return
pdf
.
save
();
}
```
This widget also features a debug switch at the bottom right to display the
drawing constraints used. This switch is available only on debug builds.
...
...
@@ -148,6 +165,7 @@ Moving on to your production application, you can keep only the `_generatePdf`
function and print the document using:
```
dart
final
title
=
'Flutter Demo'
;
await
Printing
.
layoutPdf
(
onLayout:
(
format
)
=>
_generatePdf
(
format
,
title
));
```
...
...
test/extract_readme.dart
View file @
13dcd46
...
...
@@ -49,13 +49,12 @@ void buildFile(String src, String dest, bool flutter) {
final
output
=
File
(
dest
);
final
st
=
output
.
openWrite
();
st
.
writeln
(
'import
\'
dart:io
\'
;'
);
st
.
writeln
(
'import
\'
dart:typed_data
\'
;'
);
if
(
flutter
)
{
st
.
writeln
(
'import
\'
package:flutter/services.dart
\'
show rootBundle;'
);
st
.
writeln
(
'import
\'
package:flutter/widgets.dart
\'
show AssetImage;'
);
st
.
writeln
(
'import
\'
package:path_provider/path_provider.dart
\'
;'
);
st
.
writeln
(
'import
\'
package:printing/printing.dart
\'
;'
);
}
else
{
st
.
writeln
(
'import
\'
dart:typed_data
\'
;'
);
}
st
.
writeln
(
'import
\'
package:pdf/pdf.dart
\'
;'
);
st
.
writeln
(
'import
\'
package:pdf/widgets.dart
\'
as pw;'
);
...
...
Please
register
or
login
to post a comment