You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 18, 2024. It is now read-only.
I was able to load the flutter_pdf_render deferred by using
import 'package:pdf_render/pdf_render_widgets.dart' deferred as pdf;
But the main problem which delays the initial load time is the section inside the index.html
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/build/pdf.js"
type="text/javascript"
></script>
<script type="text/javascript">
pdfjsLib.GlobalWorkerOptions.workerSrc =
"https://cdn.jsdelivr.net/npm/[email protected]/build/pdf.worker.min.js";
pdfRenderOptions = {
// where cmaps are downloaded from
cMapUrl: "https://cdn.jsdelivr.net/npm/[email protected]/cmaps/",
// The cmaps are compressed in the case
cMapPacked: true,
// any other options for pdfjsLib.getDocument.
// params: {}
};
</script>
Is it possible to load the javascript files also async from dart?
Similar to the following template section
import 'dart:async';
import 'dart:html';
Future<void> loadJavascriptFile() async {
// Create a ScriptElement
var jsScript = new ScriptElement();
jsScript.src = 'path/to/javascript/file.js';
// Wait for the load event to complete
await jsScript.onLoad.first;
// Call a function from the loaded JavaScript file
context['myFunction'].callMethod('apply', [context, ['arg1', 'arg2']]);
}
void main() async {
// Call the async function to load the JavaScript file
await loadJavascriptFile();
}
Thank you for your help in advance and this would be a great achievement to reduce the initial loading time.
The text was updated successfully, but these errors were encountered:
I was able to load the flutter_pdf_render deferred by using
import 'package:pdf_render/pdf_render_widgets.dart' deferred as pdf;
But the main problem which delays the initial load time is the section inside the index.html
Is it possible to load the javascript files also async from dart?
Similar to the following template section
Thank you for your help in advance and this would be a great achievement to reduce the initial loading time.
The text was updated successfully, but these errors were encountered: