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-06-15 16:56:44 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6391f4146cacf266f772ab6c736d81e7af6cd4cd
6391f414
1 parent
cb891660
Reword side files
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
127 additions
and
67 deletions
README.md
pdf/CHANGELOG.md
pdf/README.md
printing/CHANGELOG.md
printing/example/README.md
README.md
View file @
6391f41
# Pdf for Dart and Flutter
This set of plugin allows Flutter apps to generate and print pdf files to device printer.
This set of plugin allows Flutter apps to generate and print pdf files to device printer.
This plugin works for iOS and Android.
*
dart pdf:
<https://pub.dartlang.org/packages/pdf>
...
...
pdf/CHANGELOG.md
View file @
6391f41
# 1.3.13
## 1.3.13
*
Do not modify the TTF font streams
# 1.3.12
## 1.3.12
*
Fix TextStyle constructor
# 1.3.11
## 1.3.11
*
Update Readme
# 1.3.10
## 1.3.10
*
Deprecate the document argument in Printing.sharePdf()
*
Add default value to alpha in PdfColor variants
*
Fix Table Widget
*
Add Flexible and Spacer Widgets
# 1.3.9
## 1.3.9
*
Fix Transform Widget alignment
*
Fix CustomPaint Widget size
*
Add DecorationImage to BoxDecoration
*
Add default values to ClipRRect
# 1.3.8
## 1.3.8
*
Add jpeg image loading function
*
Add Theme::copyFrom() method
*
Allow Annotations in TextSpan
...
...
@@ -29,21 +35,25 @@
*
Implement properly RichText.softWrap
*
Set a proper value to context.pagesCount
# 1.3.7
## 1.3.7
*
Add Pdf Creation date
*
Support 64k glyphs per TTF font
# 1.3.6
## 1.3.6
*
Fix TTF Font SubSetting
# 1.3.5
## 1.3.5
*
Add some color functions
*
Remove color constants from PdfColor, use PdfColors
*
Add TTF Font SubSetting
*
Add Unicode support for TTF Fonts
*
Add Circular Progress Indicator
# 1.3.4
## 1.3.4
*
Add available dimensions for PdfPageFormat
*
Add Document properties
*
Add Page.orientation to force landscape or portrait
...
...
@@ -52,12 +62,14 @@
*
Add all Material Colors
*
Add Hyperlink widgets
# 1.3.3
## 1.3.3
*
Fix a bug with the RichText Widget
*
Update code to Dart 2.1.0
*
Add Document.save() method
# 1.3.2
## 1.3.2
*
Fix dart lint warnings
*
Improve font bounds calculation
*
Add RichText Widget
...
...
@@ -65,19 +77,23 @@
*
Add Stack Widget
*
Update Readme
# 1.3.1
## 1.3.1
*
Fix pana linting notices
# 1.3.0
## 1.3.0
*
Add a Flutter like widget system
# 1.2.0
## 1.2.0
*
Change license to Apache 2.0
*
Improve PdfRect
*
Add support for CMYK, HSL anf HSV colors
*
Implement rounded rect
# 1.1.1
## 1.1.1
*
Improve PdfPoint and PdfRect
*
Change PdfColor.fromInt to const constructor
*
Fix drawShape Bézier curves
...
...
@@ -85,7 +101,8 @@
*
Add default page margins
*
Change license to Apache 2.0
# 1.1.0
## 1.1.0
*
Rename classes to satisfy Dart conventions
*
Remove useless new and const keywords
*
Mark some internal functions as protected
...
...
@@ -98,32 +115,44 @@
*
Add unicode support for annotations and info block
*
Add Flutter example
# 1.0.8
## 1.0.8
*
Fix monospace TTF font loading
*
Add PDFPageFormat::toString
# 1.0.7
## 1.0.7
*
Use lowercase page dimension constants
# 1.0.6
## 1.0.6
*
Fix TTF font name lookup
# 1.0.5
## 1.0.5
*
Remove dependency to dart:io
*
Add Contributing
# 1.0.4
## 1.0.4
*
Updated homepage
*
Update source formatting
*
Update README
# 1.0.3
## 1.0.3
*
Remove dependency to ttf_parser
# 1.0.2
## 1.0.2
*
Update sdk support for 2.0.0
# 1.0.1
## 1.0.1
*
Add example
*
Lower vector_math dependency version
*
Uses better page format object
## 1.0.0
*
Initial version
...
...
pdf/README.md
View file @
6391f41
...
...
@@ -14,10 +14,12 @@ Use the `printing` package <https://pub.dartlang.org/packages/printing>
for full flutter print and share operation.
The coordinate system is using the internal Pdf unit:
*
1.0 is defined as 1 / 72.0 inch
*
you can use the constants for centimeters, milimeters and inch defined in PdfPageFormat
*
1.0 is defined as 1 / 72.0 inch
*
you can use the constants for centimeters, millimeters and inch defined in PdfPageFormat
Example:
```
dart
final
pdf
=
Document
();
...
...
@@ -36,9 +38,9 @@ To load an image it is possible to use the dart library [image](https://pub.dart
final
img
=
decodeImage
(
File
(
'test.webp'
).
readAsBytesSync
());
final
image
=
PdfImage
(
pdf
.
document
,
image:
img
.
data
.
buffer
.
asUint8List
(),
width:
img
.
width
,
height:
img
.
height
,
image:
img
.
data
.
buffer
.
asUint8List
(),
width:
img
.
width
,
height:
img
.
height
,
);
pdf
.
addPage
(
Page
(
...
...
printing/CHANGELOG.md
View file @
6391f41
# 2.0.4
## 2.0.4
*
Update Readme
# 2.0.3
## 2.0.3
*
Add file save and view to example application
*
Convert print screen example to Widgets
*
Deprecate the document argument in Printing.sharePdf()
# 2.0.2
## 2.0.2
*
Fix example application
# 2.0.1
## 2.0.1
*
Fix Replace FlutterErrorDetails to be compatible with Dart 2.3.0
# 2.0.0
## 2.0.0
*
Breaking change: Switch libraries to AndroidX
*
Add Page information to PdfDoc object
# 1.3.5
## 1.3.5
*
Restore compatibility with Flutter 1.0.0
*
Update code to Dart 2.1.0
*
Depends on pdf 1.3.3
# 1.3.4
## 1.3.4
*
Fix iOS build with Swift
*
Add installation instructions in the Readme
*
Follow Flutter debug painting settings
# 1.3.3
## 1.3.3
*
Fix dart lint warnings
*
Add documentation
*
Add a filename parameter for sharing
*
Convert Objective-C code to Swift
*
Update Readme
# 1.3.2
## 1.3.2
*
Fix iOS printing issues
# 1.3.1
## 1.3.1
*
Fix pana linting notices
# 1.3.0
## 1.3.0
*
Add a Flutter like widget system
# 1.2.0
## 1.2.0
*
Fix compileSdkVersion to match appcompat
*
Change license to Apache 2.0
*
Implement asynchronous printing driven by the OS
# 1.1.0
## 1.1.0
*
Rename classes to satisfy Dart conventions
*
Remove useless new and const keywords
*
Changed appcompat dependency to 26.1.0
# 1.0.6
## 1.0.6
*
Add screenshot example
# 1.0.5
## 1.0.5
*
Fix printing from pdf document
# 1.0.4
## 1.0.4
*
Update example for pdf 1.0.5
*
Add Contributing
# 1.0.3
## 1.0.3
*
Update source formatting
*
Update README
# 1.0.2
## 1.0.2
*
Add License file
*
Updated homepage
# 1.0.1
## 1.0.1
*
Fixed sdk version
# 1.0.0
## 1.0.0
*
Initial release.
...
...
printing/example/README.md
View file @
6391f41
# Pdf Printing Example
```
dart
import
'dart:async'
;
import
'package:flutter/material.dart'
;
import
'package:pdf/pdf.dart'
;
import
'package:pdf/widgets.dart'
as
P
df
;
import
'package:pdf/widgets.dart'
as
p
df
;
import
'package:printing/printing.dart'
;
void
main
(
)
=>
runApp
(
MyApp
());
...
...
@@ -22,28 +21,38 @@ class MyApp extends StatelessWidget {
child:
const
Icon
(
Icons
.
print
),
tooltip:
'Print Document'
,
onPressed:
()
{
Printing
.
layoutPdf
(
onLayout:
buildPdf
);
Printing
.
layoutPdf
(
onLayout:
buildPdf
,
);
},
),
body:
Center
(
child:
const
Text
(
'Click on the print button below'
)),
body:
Center
(
child:
const
Text
(
'Click on the print button below'
),
),
),
);
}
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
(
final
PdfDoc
doc
=
PdfDoc
();
doc
.
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
();
),
),
);
},
),
);
return
doc
.
save
();
}
}
```
...
...
Please
register
or
login
to post a comment