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-07-02 20:38:49 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4c5c62a2da07a92a17a46f43c8839c1adb290ff1
4c5c62a2
1 parent
041f8d6d
Default compress output if available
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
32 additions
and
9 deletions
pdf/CHANGELOG.md
pdf/example/main.dart
pdf/lib/pdf.dart
pdf/lib/src/archive.dart
pdf/lib/src/document.dart
pdf/lib/src/io.dart
pdf/lib/widgets/document.dart
pdf/pubspec.yaml
printing/README.md
printing/example/README.md
printing/example/lib/document.dart
printing/example/lib/main.dart
printing/lib/printing.dart
printing/lib/src/widgets.dart
pdf/CHANGELOG.md
View file @
4c5c62a
...
...
@@ -4,6 +4,7 @@
*
Add encryption support
*
Increase PDF version to 1.7
*
Add document signature support
*
Default compress output if available
## 1.3.13
...
...
pdf/example/main.dart
View file @
4c5c62a
...
...
@@ -4,7 +4,7 @@ import 'package:pdf/pdf.dart';
import
'package:pdf/widgets.dart'
;
void
main
(
)
{
final
Document
pdf
=
Document
(
deflate:
zlib
.
encode
);
final
Document
pdf
=
Document
();
pdf
.
addPage
(
MultiPage
(
pageFormat:
...
...
pdf/lib/pdf.dart
View file @
4c5c62a
...
...
@@ -26,6 +26,8 @@ import 'package:meta/meta.dart';
import
'package:utf/utf.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'src/io.dart'
if
(
dart
.
library
.
io
)
'src/archive.dart'
;
part
'src/annotation.dart'
;
part
'src/array.dart'
;
part
'src/ascii85.dart'
;
...
...
pdf/lib/src/archive.dart
0 → 100644
View file @
4c5c62a
import
'package:archive/archive.dart'
;
import
'package:pdf/pdf.dart'
;
DeflateCallback
defaultDeflate
=
ZLibEncoder
().
encode
;
...
...
pdf/lib/src/document.dart
View file @
4c5c62a
...
...
@@ -46,7 +46,11 @@ class PdfDocument {
/// This creates a Pdf document
/// @param pagemode an int, determines how the document will present itself to
/// the viewer when it first opens.
PdfDocument
({
PdfPageMode
pageMode
=
PdfPageMode
.
none
,
this
.
deflate
})
{
PdfDocument
({
PdfPageMode
pageMode
=
PdfPageMode
.
none
,
DeflateCallback
deflate
,
bool
compress
=
true
,
})
:
deflate
=
compress
?
(
deflate
??
defaultDeflate
)
:
null
{
_objser
=
1
;
// Now create some standard objects
...
...
pdf/lib/src/io.dart
0 → 100644
View file @
4c5c62a
import
'dart:io'
;
import
'package:pdf/pdf.dart'
;
DeflateCallback
defaultDeflate
=
zlib
.
encode
;
...
...
pdf/lib/widgets/document.dart
View file @
4c5c62a
...
...
@@ -20,6 +20,7 @@ class Document {
Document
(
{
PdfPageMode
pageMode
=
PdfPageMode
.
none
,
DeflateCallback
deflate
,
bool
compress
=
true
,
this
.
theme
,
String
title
,
String
author
,
...
...
@@ -27,7 +28,11 @@ class Document {
String
subject
,
String
keywords
,
String
producer
})
:
document
=
PdfDocument
(
pageMode:
pageMode
,
deflate:
deflate
)
{
:
document
=
PdfDocument
(
pageMode:
pageMode
,
deflate:
deflate
,
compress:
compress
,
)
{
if
(
title
!=
null
||
author
!=
null
||
creator
!=
null
||
...
...
pdf/pubspec.yaml
View file @
4c5c62a
...
...
@@ -14,6 +14,7 @@ dependencies:
vector_math
:
"
^2.0.0"
utf
:
"
^0.9.0"
crypto
:
"
^2.0.6"
archive
:
"
^2.0.10"
dev_dependencies
:
test
:
any
...
...
printing/README.md
View file @
4c5c62a
...
...
@@ -14,7 +14,7 @@ for documentation.
Example:
```
dart
final
pdf
=
PdfDoc
();
final
pdf
=
Document
();
pdf
.
addPage
(
Page
(
pageFormat:
PdfPageFormat
.
a4
,
...
...
printing/example/README.md
View file @
4c5c62a
...
...
@@ -34,7 +34,7 @@ class MyApp extends StatelessWidget {
}
List
<
int
>
buildPdf
(
PdfPageFormat
format
)
{
final
PdfDoc
doc
=
PdfDoc
();
final
Document
doc
=
Document
();
doc
.
addPage
(
pdf
.
Page
(
...
...
printing/example/lib/document.dart
View file @
4c5c62a
...
...
@@ -107,7 +107,7 @@ class Category extends StatelessWidget {
}
Future
<
Document
>
generateDocument
(
PdfPageFormat
format
)
async
{
final
PdfDoc
pdf
=
PdfDoc
(
title:
'My Résumé'
,
author:
'David PHAM-VAN'
);
final
Document
pdf
=
Document
(
title:
'My Résumé'
,
author:
'David PHAM-VAN'
);
final
PdfImage
profileImage
=
await
pdfImageFromImageProvider
(
pdf:
pdf
.
document
,
...
...
printing/example/lib/main.dart
View file @
4c5c62a
...
...
@@ -74,7 +74,7 @@ class MyAppState extends State<MyApp> {
print
(
'Print Screen
${im.width}
x
${im.height}
...'
);
Printing
.
layoutPdf
(
onLayout:
(
PdfPageFormat
format
)
{
final
pdf
.
Document
document
=
PdfDoc
();
final
pdf
.
Document
document
=
pdf
.
Document
();
final
PdfImage
image
=
PdfImage
(
document
.
document
,
image:
bytes
.
buffer
.
asUint8List
(),
...
...
printing/lib/printing.dart
View file @
4c5c62a
...
...
@@ -17,7 +17,6 @@
library
printing
;
import
'dart:async'
;
import
'dart:io'
;
import
'dart:typed_data'
;
import
'dart:ui'
as
ui
;
...
...
printing/lib/src/widgets.dart
View file @
4c5c62a
...
...
@@ -16,6 +16,7 @@
part of
printing
;
@deprecated
class
PdfDoc
extends
Document
{
/// Wrapper for a [Document] with zlib compression enabled by default
PdfDoc
(
...
...
@@ -29,7 +30,7 @@ class PdfDoc extends Document {
String
keywords
,
String
producer
})
:
super
(
deflate:
compress
?
zlib
.
encode
:
null
,
compress:
compress
,
pageMode:
pageMode
,
theme:
theme
,
title:
title
,
...
...
Please
register
or
login
to post a comment