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-05 12:08:54 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
174a1fa9802e37e64760ed0c43c182df9d5ef961
174a1fa9
1 parent
1c15f67e
Add file save and view to example application
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
62 additions
and
4 deletions
printing/CHANGELOG.md
printing/example/android/app/build.gradle
printing/example/ios/Runner.xcodeproj/project.pbxproj
printing/example/lib/main.dart
printing/example/lib/viewer.dart
printing/example/pubspec.yaml
printing/pubspec.yaml
printing/CHANGELOG.md
View file @
174a1fa
# 2.0.3
*
Add file save and view to example application
# 2.0.2
*
Fix example application
...
...
printing/example/android/app/build.gradle
View file @
174a1fa
...
...
@@ -46,6 +46,18 @@ android {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig
signingConfigs
.
debug
minifyEnabled
true
useProguard
true
proguardFiles
getDefaultProguardFile
(
'proguard-android.txt'
),
'proguard-rules.pro'
ndk
{
abiFilters
'armeabi-v7a'
}
}
debug
{
minifyEnabled
false
useProguard
false
}
}
}
...
...
printing/example/ios/Runner.xcodeproj/project.pbxproj
View file @
174a1fa
...
...
@@ -249,6 +249,8 @@
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
"${BUILT_PRODUCTS_DIR}/flutter_full_pdf_viewer/flutter_full_pdf_viewer.framework",
"${BUILT_PRODUCTS_DIR}/path_provider/path_provider.framework",
"${BUILT_PRODUCTS_DIR}/printing/printing.framework",
);
name = "[CP] Embed Pods Frameworks";
...
...
@@ -256,6 +258,8 @@
);
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_full_pdf_viewer.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/printing.framework",
);
runOnlyForDeploymentPostprocessing = 0;
...
...
printing/example/lib/main.dart
View file @
174a1fa
...
...
@@ -5,12 +5,14 @@ import 'dart:ui' as ui;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:path_provider/path_provider.dart'
;
import
'package:pdf/pdf.dart'
;
import
'package:pdf/widgets.dart'
as
pdf
;
import
'package:printing/printing.dart'
;
import
'package:printing_example/document.dart'
;
import
'document.dart'
;
import
'viewer.dart'
;
void
main
(
)
=>
runApp
(
MaterialApp
(
home:
MyApp
()));
...
...
@@ -32,6 +34,19 @@ class MyAppState extends State<MyApp> {
(
await
generateDocument
(
format
)).
save
());
}
Future
<
void
>
_saveAsFile
()
async
{
Directory
appDocDir
=
await
getApplicationDocumentsDirectory
();
String
appDocPath
=
appDocDir
.
path
;
File
file
=
File
(
appDocPath
+
'/'
+
'document.pdf'
);
print
(
'Save as file
${file.path}
...'
);
await
file
.
writeAsBytes
((
await
generateDocument
(
PdfPageFormat
.
a4
)).
save
());
Navigator
.
push
<
dynamic
>(
context
,
MaterialPageRoute
<
dynamic
>(
builder:
(
BuildContext
context
)
=>
PdfViewer
(
file:
file
)),
);
}
Future
<
void
>
_sharePdf
()
async
{
print
(
'Share ...'
);
final
pdf
.
Document
document
=
await
generateDocument
(
PdfPageFormat
.
a4
);
...
...
@@ -117,6 +132,8 @@ class MyAppState extends State<MyApp> {
RaisedButton
(
child:
const
Text
(
'Print Screenshot'
),
onPressed:
_printScreen
),
RaisedButton
(
child:
const
Text
(
'Save to file'
),
onPressed:
_saveAsFile
),
],
),
),
...
...
printing/example/lib/viewer.dart
0 → 100644
View file @
174a1fa
import
'dart:io'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_full_pdf_viewer/flutter_full_pdf_viewer.dart'
;
import
'package:flutter_full_pdf_viewer/full_pdf_viewer_plugin.dart'
;
import
'package:flutter_full_pdf_viewer/full_pdf_viewer_scaffold.dart'
;
class
PdfViewer
extends
StatelessWidget
{
const
PdfViewer
({
this
.
file
});
final
File
file
;
@override
Widget
build
(
BuildContext
context
)
{
return
PDFViewerScaffold
(
appBar:
AppBar
(
title:
const
Text
(
'Document'
),
),
path:
file
.
path
);
}
}
...
...
printing/example/pubspec.yaml
View file @
174a1fa
...
...
@@ -10,8 +10,9 @@ dependencies:
flutter
:
sdk
:
flutter
printing
:
cupertino_icons
:
^0.1.2
path_provider
:
flutter_full_pdf_viewer
:
cupertino_icons
:
dev_dependencies
:
flutter_test
:
...
...
printing/pubspec.yaml
View file @
174a1fa
...
...
@@ -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.
2
version
:
2.0.
3
environment
:
sdk
:
"
>=2.1.0
<3.0.0"
...
...
Please
register
or
login
to post a comment