-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patch pdfium wasm for esm compatibility, and add loader example and w…
…orkaround to App.vue
- Loading branch information
Showing
12 changed files
with
1,115 additions
and
38 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "pdfium", | ||
"collaborators": [ | ||
"Sam Sieber" | ||
], | ||
"version": "0.1.0", | ||
"files": [ | ||
"pdfium.wasm", | ||
"pdfium.js" | ||
], | ||
"types": "pdfium.d.ts", | ||
"module": "pdfium.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
declare module 'pdfium' { | ||
export default function PDFiumModule(module_or_path?: any): Promise<any>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
diff --git a/ui/pdfium/pkg/pdfium.js b/ui/pdfium/pkg/original.js | ||
index 94f7926..d06d540 100644 | ||
--- a/ui/pdfium/pkg/pdfium.js | ||
+++ b/ui/pdfium/pkg/original.js | ||
@@ -1,4 +1,4 @@ | ||
-export default (() => { | ||
+var PDFiumModule = (() => { | ||
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined; | ||
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename; | ||
return ( | ||
@@ -415,7 +415,7 @@ export default (() => { | ||
} | ||
} | ||
var wasmBinaryFile; | ||
- wasmBinaryFile = "pdfium_bg.wasm"; | ||
+ wasmBinaryFile = "pdfium.wasm"; | ||
if (!isDataURI(wasmBinaryFile)) { | ||
wasmBinaryFile = locateFile(wasmBinaryFile) | ||
} | ||
@@ -462,7 +462,7 @@ export default (() => { | ||
|
||
function instantiateAsync(binary, binaryFile, imports, callback) { | ||
if (!binary && typeof WebAssembly.instantiateStreaming == "function" && !isDataURI(binaryFile) && !isFileURI(binaryFile) && !ENVIRONMENT_IS_NODE && typeof fetch == "function") { | ||
- return fetch(new URL(binaryFile, import.meta.url), { | ||
+ return fetch(binaryFile, { | ||
credentials: "same-origin" | ||
}).then(response => { | ||
var result = WebAssembly.instantiateStreaming(response, imports); | ||
@@ -4820,3 +4820,7 @@ export default (() => { | ||
} | ||
); | ||
})();; | ||
+if (typeof exports === 'object' && typeof module === 'object') | ||
+ module.exports = PDFiumModule; | ||
+else if (typeof define === 'function' && define['amd']) | ||
+ define([], () => PDFiumModule); |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters