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
2023-01-29 08:37:20 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
31dd7fdb0ba7f10bc0975bf5eee9fc6bb9c0f40e
31dd7fdb
1 parent
2fa82229
Fix loading pdfjs in debug mode
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
30 deletions
printing/CHANGELOG.md
printing/lib/printing_web.dart
printing/pubspec.yaml
printing/CHANGELOG.md
View file @
31dd7fd
# Changelog
## 5.10.1
-
Fix loading pdfjs in debug mode
## 5.10.0
-
Remove deprecated Android embedding
...
...
printing/lib/printing_web.dart
View file @
31dd7fd
...
...
@@ -65,6 +65,15 @@ class PrintingPlugin extends PrintingPlatform {
await
_loading
.
acquire
();
if
(!
_hasPdfJsLib
)
{
dynamic
amd
;
dynamic
define
;
if
(
js
.
context
[
'define'
]
!=
null
)
{
// In dev, requireJs is loaded in. Disable it here.
define
=
js
.
JsObject
.
fromBrowserObject
(
js
.
context
[
'define'
]);
amd
=
define
[
'amd'
];
define
[
'amd'
]
=
false
;
}
final
script
=
ScriptElement
()
..
type
=
'text/javascript'
..
async
=
true
...
...
@@ -73,35 +82,9 @@ class PrintingPlugin extends PrintingPlatform {
document
.
head
!.
append
(
script
);
await
script
.
onLoad
.
first
;
if
(
js
.
context
[
'pdfjsLib'
]
==
null
)
{
// In dev, requireJs is loaded in
final
require
=
js
.
JsObject
.
fromBrowserObject
(
js
.
context
[
'require'
]);
require
.
callMethod
(
'config'
,
<
dynamic
>[
js
.
JsObject
.
jsify
({
'paths'
:
{
'pdfjs-dist/build/pdf'
:
'
$_pdfJsUrlBase
/build/pdf.min'
,
'pdfjs-dist/build/pdf.worker'
:
'
$_pdfJsUrlBase
/build/pdf.worker.min'
,
}
})
]);
final
completer
=
Completer
<
void
>();
js
.
context
.
callMethod
(
'require'
,
<
dynamic
>[
js
.
JsObject
.
jsify
(
[
'pdfjs-dist/build/pdf'
,
'pdfjs-dist/build/pdf.worker'
,
],
),
(
dynamic
app
)
{
js
.
context
[
'pdfjsLib'
]
=
app
;
completer
.
complete
();
}
]);
await
completer
.
future
;
if
(
amd
!=
null
)
{
// Re-enable requireJs
define
[
'amd'
]
=
amd
;
}
js
.
context
[
'pdfjsLib'
][
'GlobalWorkerOptions'
][
'workerSrc'
]
=
...
...
printing/pubspec.yaml
View file @
31dd7fd
...
...
@@ -9,7 +9,7 @@ issue_tracker: https://github.com/DavBfr/dart_pdf/issues
screenshots
:
-
description
:
'
Printing
a
document
on
iOS'
path
:
example.png
version
:
5.10.
0
version
:
5.10.
1
environment
:
sdk
:
"
>=2.18.0
<3.0.0"
...
...
Please
register
or
login
to post a comment