Skip to content

Commit

Permalink
Fix pdf import on web
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Nov 10, 2024
1 parent 6c9b52c commit ff6fa96
Show file tree
Hide file tree
Showing 11 changed files with 174 additions and 56,548 deletions.
3 changes: 2 additions & 1 deletion app/lib/services/import.dart
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,8 @@ class ImportService {

Future<NoteData?> importPdf(Uint8List bytes, NoteData document,
{Offset? position, bool advanced = true}) async {
final dialog = showLoadingDialog(context);
try {
final dialog = showLoadingDialog(context);
final firstPos = position ?? Offset.zero;
final elements = <Uint8List>[];
final localizations = AppLocalizations.of(context);
Expand Down Expand Up @@ -641,6 +641,7 @@ class ImportService {
);
}
} catch (e) {
dialog?.close();
showDialog(
context: context,
builder: (context) =>
Expand Down
32 changes: 16 additions & 16 deletions app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,10 @@ packages:
dependency: transitive
description:
name: camera_avfoundation
sha256: "0d04cec8715b59fb6dc60eefb47e69024f51233c570e475b886dc9290568bca7"
sha256: "2e4c568f70e406ccb87376bc06b53d2f5bebaab71e2fbcc1a950e31449381bcf"
url: "https://pub.dev"
source: hosted
version: "0.9.17+4"
version: "0.9.17+5"
camera_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -346,10 +346,10 @@ packages:
dependency: "direct main"
description:
name: device_info_plus
sha256: c4af09051b4f0508f6c1dc0a5c085bf014d5c9a4a0678ce1799c2b4d716387a0
sha256: f545ffbadee826f26f2e1a0f0cbd667ae9a6011cc0f77c0f8f00a969655e6e95
url: "https://pub.dev"
source: hosted
version: "11.1.0"
version: "11.1.1"
device_info_plus_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -602,10 +602,10 @@ packages:
dependency: "direct main"
description:
name: flutter_svg
sha256: "2ca230f2ef6e31151769f4a03ec806b94f0554ff02ea1a40bb0d531ac150f035"
sha256: "578bd8c508144fdaffd4f77b8ef2d8c523602275cd697cc3db284dbd762ef4ce"
url: "https://pub.dev"
source: hosted
version: "2.0.12"
version: "2.0.14"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down Expand Up @@ -956,10 +956,10 @@ packages:
dependency: "direct main"
description:
name: package_info_plus
sha256: df3eb3e0aed5c1107bb0fdb80a8e82e778114958b1c5ac5644fb1ac9cae8a998
sha256: da8d9ac8c4b1df253d1a328b7bf01ae77ef132833479ab40763334db13b91cce
url: "https://pub.dev"
source: hosted
version: "8.1.0"
version: "8.1.1"
package_info_plus_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -1229,18 +1229,18 @@ packages:
dependency: transitive
description:
name: sembast
sha256: dc42f8384edc2bc0c11c90856fa62630ad2a75d8a37c786e000517bd8298682d
sha256: "61f893e50fe2fa7d14529d275d45ac31871d7ad2ae3a745f9aa3afc0b447d75b"
url: "https://pub.dev"
source: hosted
version: "3.7.5"
version: "3.7.5+2"
share_plus:
dependency: "direct main"
description:
name: share_plus
sha256: "3af2cda1752e5c24f2fc04b6083b40f013ffe84fb90472f30c6499a9213d5442"
sha256: "9c9bafd4060728d7cdb2464c341743adbd79d327cb067ec7afb64583540b47c8"
url: "https://pub.dev"
source: hosted
version: "10.1.1"
version: "10.1.2"
share_plus_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -1546,10 +1546,10 @@ packages:
dependency: transitive
description:
name: vector_graphics
sha256: "0b9149c6ddb013818075b072b9ddc1b89a5122fff1275d4648d297086b46c4f0"
sha256: "773c9522d66d523e1c7b25dfb95cc91c26a1e17b107039cfe147285e92de7878"
url: "https://pub.dev"
source: hosted
version: "1.1.12"
version: "1.1.14"
vector_graphics_codec:
dependency: transitive
description:
Expand All @@ -1562,10 +1562,10 @@ packages:
dependency: transitive
description:
name: vector_graphics_compiler
sha256: f3b9b6e4591c11394d4be4806c63e72d3a41778547b2c1e2a8a04fadcfd7d173
sha256: "26d520739b7c6b5d2a2b3274427874a8390831fd4cd5bb8cfbd7d913477d3a2e"
url: "https://pub.dev"
source: hosted
version: "1.1.12"
version: "1.1.14"
vector_math:
dependency: transitive
description:
Expand Down
4 changes: 2 additions & 2 deletions app/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@
}
});
</script>
<script src="pdf.js/pdf.min.mjs" type="module"></script>
<script src="pdf.js/pdf.min.js" type="module"></script>
<script type="module">
var { pdfjsLib } = globalThis;
pdfjsLib.GlobalWorkerOptions.workerSrc = "pdf.js/pdf.worker.min.mjs";
pdfjsLib.GlobalWorkerOptions.workerSrc = "pdf.js/pdf.worker.min.js";
</script>
<script src="flutter_bootstrap.js" async></script>
</body>
Expand Down
22 changes: 22 additions & 0 deletions app/web/pdf.js/pdf.min.js

Large diffs are not rendered by default.

21 changes: 0 additions & 21 deletions app/web/pdf.js/pdf.min.mjs

This file was deleted.

22 changes: 22 additions & 0 deletions app/web/pdf.js/pdf.worker.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit ff6fa96

Please sign in to comment.