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
Marcos Rodriguez
2020-06-08 14:37:04 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
David PHAM-VAN
2020-06-08 16:05:23 -0400
Commit
32814dd668cb5046b02a692365123a471f9c2e27
32814dd6
1 parent
6e74f850
Added pdfFileName prop
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
3 deletions
printing/CHANGELOG.md
printing/lib/src/pdf_preview.dart
printing/pubspec.yaml
printing/CHANGELOG.md
View file @
32814dd
# Changelog
## 3.6.0
-
Added pdfFileName prop to PdfPreview Widget
[
Marcos Rodriguez
]
## 3.5.0
-
Add decoration options to the PdfPreview Widget
[
Marcos Rodriguez
]
...
...
printing/lib/src/pdf_preview.dart
View file @
32814dd
...
...
@@ -28,6 +28,7 @@ class PdfPreview extends StatefulWidget {
this
.
onShared
,
this
.
scrollViewDecoration
,
this
.
pdfPreviewPageDecoration
,
this
.
pdfFileName
,
})
:
super
(
key:
key
);
/// Called when a pdf document is needed
...
...
@@ -69,6 +70,9 @@ class PdfPreview extends StatefulWidget {
/// Decoration of _PdfPreviewPage
final
Decoration
pdfPreviewPageDecoration
;
/// Name of the PDF when sharing. It must include the extension.
final
String
pdfFileName
;
@override
_PdfPreviewState
createState
()
=>
_PdfPreviewState
();
}
...
...
@@ -365,7 +369,11 @@ class _PdfPreviewState extends State<PdfPreview> {
}
Future
<
void
>
_print
()
async
{
final
result
=
await
Printing
.
layoutPdf
(
onLayout:
widget
.
build
);
final
result
=
await
Printing
.
layoutPdf
(
onLayout:
widget
.
build
,
name:
widget
.
pdfFileName
,
format:
pageFormat
,
);
if
(
result
&&
widget
.
onPrinted
!=
null
)
{
widget
.
onPrinted
(
context
);
...
...
@@ -383,7 +391,8 @@ class _PdfPreviewState extends State<PdfPreview> {
final
bounds
=
Rect
.
fromPoints
(
topLeft
,
bottomRight
);
final
bytes
=
await
widget
.
build
(
pageFormat
);
final
result
=
await
Printing
.
sharePdf
(
bytes:
bytes
,
bounds:
bounds
);
final
result
=
await
Printing
.
sharePdf
(
bytes:
bytes
,
bounds:
bounds
,
filename:
widget
.
pdfFileName
);
if
(
result
&&
widget
.
onShared
!=
null
)
{
widget
.
onShared
(
context
);
...
...
printing/pubspec.yaml
View file @
32814dd
...
...
@@ -4,7 +4,7 @@ description: Plugin that allows Flutter apps to generate and print documents to
homepage
:
https://github.com/DavBfr/dart_pdf/tree/master/printing
repository
:
https://github.com/DavBfr/dart_pdf
issue_tracker
:
https://github.com/DavBfr/dart_pdf/issues
version
:
3.
5
.0
version
:
3.
6
.0
environment
:
sdk
:
"
>=2.3.0
<3.0.0"
...
...
Please
register
or
login
to post a comment