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
Gamal AbdelNasser
2024-03-05 02:11:36 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
David PHAM-VAN
2024-03-11 08:05:14 -0300
Commit
462bd71ee690d52cb04883637c9f7682b6337c49
462bd71e
1 parent
a67f42da
Save in an isolate when available
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
7 deletions
pdf/CHANGELOG.md
pdf/lib/src/pdf/document.dart
pdf/lib/src/pdf/io/js.dart
pdf/lib/src/pdf/io/vm.dart
pdf/pubspec.yaml
pdf/CHANGELOG.md
View file @
462bd71
# Changelog
## 3.11.0
-
Save in an isolate when available
## 3.10.8
-
Add Flutter's Logical Pixel constant
...
...
pdf/lib/src/pdf/document.dart
View file @
462bd71
...
...
@@ -251,11 +251,13 @@ class PdfDocument {
/// Generate the PDF document as a memory file
Future
<
Uint8List
>
save
()
async
{
final
os
=
PdfStream
();
if
(
prev
!=
null
)
{
os
.
putBytes
(
prev
!.
bytes
);
}
await
_write
(
os
);
return
os
.
output
();
return
pdfCompute
(()
async
{
final
os
=
PdfStream
();
if
(
prev
!=
null
)
{
os
.
putBytes
(
prev
!.
bytes
);
}
await
_write
(
os
);
return
os
.
output
();
});
}
}
...
...
pdf/lib/src/pdf/io/js.dart
View file @
462bd71
...
...
@@ -20,3 +20,10 @@ import '../format/object_base.dart';
/// Zip compression function
DeflateCallback
defaultDeflate
=
const
ZLibEncoder
().
encode
;
/// The dart:html implementation of [pdfCompute].
@pragma
(
'dart2js:tryInline'
)
Future
<
R
>
pdfCompute
<
R
>(
Future
<
R
>
Function
()
computation
)
async
{
await
null
;
return
computation
();
}
...
...
pdf/lib/src/pdf/io/vm.dart
View file @
462bd71
...
...
@@ -15,8 +15,14 @@
*/
import
'dart:io'
;
import
'dart:isolate'
;
import
'../format/object_base.dart'
;
/// Zip compression function
DeflateCallback
defaultDeflate
=
zlib
.
encode
;
/// The dart:io implementation of [pdfCompute].
@pragma
(
'vm:prefer-inline'
)
Future
<
R
>
pdfCompute
<
R
>(
Future
<
R
>
Function
()
computation
)
async
=>
Isolate
.
run
<
R
>(
computation
,
debugName:
'dart_pdf'
);
...
...
pdf/pubspec.yaml
View file @
462bd71
...
...
@@ -15,7 +15,7 @@ topics:
version
:
3.10.8
environment
:
sdk
:
"
>=2.1
8
.0
<4.0.0"
sdk
:
"
>=2.1
9
.0
<4.0.0"
dependencies
:
archive
:
^3.1.0
...
...
Please
register
or
login
to post a comment