Foxit PDF SDK for Web

How to use the preload worker thread with Foxit PDF SDK for Web

preloadJRWorker is our web SDK worker thread to perform tasks in the background. With version 7, we have made major improvements to the worker in order to reduce loading time. It can run simultaneously with the SDK JS libraries to initialize data in different threads.

The following shows code examples to set up the preloadJrWorker in an Index file.

HTML Index / js File calling preloadJrWorker since version 7
<div id=”pdf-ui”></div>
<script src=”../../license-key.js”></script>
<script src=”../../../lib/preload-jr-worker.js”></script>
<script>
var readyWorker = preloadJrWorker({
workerPath: ‘../../../lib/’,
enginePath: ‘../lib/jr-engine/gsdk’,
fontPath: ‘../external/brotli’,
readBlock:8192,
licenseSN: licenseSN,
licenseKey: licenseKey
})
</script>
<script src=”../../../lib/UIExtension.full.js”></script>
<script>
var PDFUI = UIExtension.PDFUI;
var Events = UIExtension.PDFViewCtrl.Events;
var pdfui = new PDFUI({
viewerOptions: {
libPath: ‘../../../lib’,
jr: {
readyWorker: readyWorker
}
},
renderTo: ‘#pdf-ui’,
appearance: UIExtension.appearances.adaptive,
fragments: [],
addons: [
‘“`’
].concat(UIExtension.PDFViewCtrl.DeviceInfo.isMobile ? [] : ‘../../../lib/uix-addons/text-object’)
});

Updated on August 11, 2021

Was this article helpful?
Thanks for your feedback. If you have a comment on how to improve the article, you can write it here: