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-02-26 09:01:45 -0500
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6c47088a94a17a79e63beea19158d56b328142ab
6c47088a
1 parent
658551a8
Fix podspec for Swift
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
75 additions
and
13 deletions
printing/CHANGELOG.md
printing/README.md
printing/example/README.md
printing/ios/printing.podspec
printing/pubspec.yaml
printing/CHANGELOG.md
View file @
6c47088
# 1.3.4
*
Fix iOS build with Swift
*
Add installation instructions in the Readme
# 1.3.3
*
Fix dart lint warnings
*
Add documentation
...
...
printing/README.md
View file @
6c47088
...
...
@@ -34,3 +34,29 @@ PdfTtfFont ttf = PdfTtfFont(pdf, font);
g
.
setColor
(
PdfColor
(
0.3
,
0.3
,
0.3
));
g
.
drawString
(
ttf
,
20.0
,
"Dart is awesome"
,
50.0
,
30.0
);
```
## Installing
1.
Add this to your package's
`pubspec.yaml`
file:
```
yaml
dependencies
:
printing
:
any
# <-- Add this line
```
2.
Enable Swift on the iOS project, in
`ios/Podfile`
:
```
Ruby
target 'Runner' do
use_frameworks! # <-- Add this line
```
3.
Set minimum Android version in
`android/app/build.gradle`
:
```
java
defaultConfig
{
...
minSdkVersion
19
// <-- Change this line to 19 or more
...
}
```
...
...
printing/example/README.md
View file @
6c47088
# Pdf Printing Example
```
dart
void
printPdf
(
)
{
Printing
.
layoutPdf
(
onLayout:
(
PdfPageFormat
format
)
{
final
pdf
=
Document
()
..
addPage
(
Page
(
pageFormat:
PdfPageFormat
.
a4
,
build:
(
Context
context
)
{
return
Center
(
child:
Text
(
"Hello World"
),
);
// Center
import
'dart:async'
;
import
'package:flutter/material.dart'
;
import
'package:pdf/pdf.dart'
;
import
'package:pdf/widgets.dart'
as
Pdf
;
import
'package:printing/printing.dart'
;
void
main
(
)
=>
runApp
(
MyApp
());
class
MyApp
extends
StatelessWidget
{
@override
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
home:
Scaffold
(
appBar:
AppBar
(
title:
Text
(
'Printing Demo'
),
),
body:
Center
(
child:
FlatButton
(
child:
Text
(
"Print Document"
),
onPressed:
()
{
Printing
.
layoutPdf
(
onLayout:
buildPdf
);
},
),
),
),
);
}
List
<
int
>
buildPdf
(
PdfPageFormat
format
)
{
final
PdfDoc
pdf
=
PdfDoc
()
..
addPage
(
Pdf
.
Page
(
pageFormat:
format
,
build:
(
Pdf
.
Context
context
)
{
return
Pdf
.
ConstrainedBox
(
constraints:
const
Pdf
.
BoxConstraints
.
expand
(),
child:
Pdf
.
FittedBox
(
child:
Pdf
.
Text
(
"Hello World"
,
)),
);
}));
return
pdf
.
save
();
});
// Page
return
pdf
.
document
.
save
();
}
}
```
...
...
printing/ios/printing.podspec
View file @
6c47088
...
...
@@ -17,5 +17,5 @@ Plugin that allows Flutter apps to generate and print documents to android or io
s
.
dependency
'Flutter'
s
.
ios
.
deployment_target
=
'8.0'
s
.
swift_version
=
'4.2'
end
...
...
printing/pubspec.yaml
View file @
6c47088
...
...
@@ -2,7 +2,7 @@ name: printing
author
:
David PHAM-VAN <dev.nfet.net@gmail.com>
description
:
Plugin that allows Flutter apps to generate and print documents to android or ios compatible printers
homepage
:
https://github.com/DavBfr/dart_pdf/tree/master/printing
version
:
1.3.
3
version
:
1.3.
4
environment
:
sdk
:
"
>=1.19.0
<3.0.0"
...
...
Please
register
or
login
to post a comment