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
2019-05-04 14:38:57 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ea4b3dead17e23cc6cc09209541d1b48505f14b8
ea4b3dea
1 parent
59c80708
Fix example application
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
7 deletions
printing/CHANGELOG.md
printing/example/lib/document.dart
printing/example/lib/main.dart
printing/example/test/pdf_test.dart
printing/pubspec.yaml
printing/CHANGELOG.md
View file @
ea4b3de
# 2.0.2
*
Fix example application
# 2.0.1
*
Fix Replace FlutterErrorDetails to be compatible with Dart 2.3.0
...
...
printing/example/lib/document.dart
View file @
ea4b3de
...
...
@@ -106,7 +106,7 @@ class Category extends StatelessWidget {
}
}
Future
<
Pdf
Document
>
generateDocument
(
PdfPageFormat
format
)
async
{
Future
<
Document
>
generateDocument
(
PdfPageFormat
format
)
async
{
final
PdfDoc
pdf
=
PdfDoc
(
title:
'My Résumé'
,
author:
'David PHAM-VAN'
);
final
PdfImage
profileImage
=
await
pdfImageFromImageProvider
(
...
...
@@ -198,5 +198,5 @@ Future<PdfDocument> generateDocument(PdfPageFormat format) async {
])
]),
));
return
pdf
.
document
;
return
pdf
;
}
...
...
printing/example/lib/main.dart
View file @
ea4b3de
...
...
@@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
import
'package:flutter/rendering.dart'
;
import
'package:pdf/pdf.dart'
;
import
'package:pdf/widgets.dart'
as
pdf
;
import
'package:printing/printing.dart'
;
import
'package:printing_example/document.dart'
;
...
...
@@ -33,7 +34,7 @@ class MyAppState extends State<MyApp> {
Future
<
void
>
_sharePdf
()
async
{
print
(
'Share ...'
);
final
PdfDocument
pdf
=
await
generateDocument
(
PdfPageFormat
.
a4
);
final
pdf
.
Document
document
=
await
generateDocument
(
PdfPageFormat
.
a4
);
// Calculate the widget center for iPad sharing popup position
final
RenderBox
referenceBox
=
...
...
@@ -44,7 +45,8 @@ class MyAppState extends State<MyApp> {
referenceBox
.
localToGlobal
(
referenceBox
.
paintBounds
.
bottomRight
);
final
Rect
bounds
=
Rect
.
fromPoints
(
topLeft
,
bottomRight
);
Printing
.
sharePdf
(
document:
pdf
,
filename:
'my-résumé.pdf'
,
bounds:
bounds
);
await
Printing
.
sharePdf
(
bytes:
document
.
save
(),
filename:
'my-résumé.pdf'
,
bounds:
bounds
);
}
Future
<
void
>
_printScreen
()
async
{
...
...
printing/example/test/pdf_test.dart
View file @
ea4b3de
...
...
@@ -3,13 +3,14 @@ import 'dart:io';
import
'package:flutter_test/flutter_test.dart'
;
import
'package:pdf/pdf.dart'
;
import
'package:pdf/widgets.dart'
as
pdf
;
import
'package:printing_example/document.dart'
;
void
main
(
)
{
testWidgets
(
'Pdf Generate the document'
,
(
WidgetTester
tester
)
async
{
final
PdfDocument
pdf
=
await
generateDocument
(
PdfPageFormat
.
a4
);
final
pdf
.
Document
document
=
await
generateDocument
(
PdfPageFormat
.
a4
);
final
File
file
=
File
(
'document.pdf'
);
file
.
writeAsBytesSync
(
pdf
.
save
());
file
.
writeAsBytesSync
(
document
.
save
());
});
}
...
...
printing/pubspec.yaml
View file @
ea4b3de
...
...
@@ -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
:
2.0.
1
version
:
2.0.
2
environment
:
sdk
:
"
>=2.1.0
<3.0.0"
...
...
Please
register
or
login
to post a comment