question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error during font loading: Failed to execute 'postMessage' on 'Worker': ArrayBuffer at index 0 is already detached

See original GitHub issue
 - vue-pdf version 4.0.11
 - vue.js version 2.6.11

import CMapReaderFactory from 'vue-pdf/src/CMapReaderFactory.js' this.vuePdfSrc = pdf.createLoadingTask({url:src,CMapReaderFactory}) after use CMapReaderFactory ,First rendering of PDF file ,Fonts can be realistic. But when I switch the URL of the PDF file, I call again this.vuePdfSrc = pdf.createLoadingTask({url:src,CMapReaderFactory}) Console prompt Warning: Error during font loading: Failed to execute 'postMessage' on 'Worker': ArrayBuffer at index 0 is already detached. and Some fonts cannot be displayed. Is there something wrong with the way I use it? I need to toggle the PDF file on the same page Thank you in advance for your answer

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:29

github_iconTop GitHub Comments

9reactions
quyongcommented, Oct 22, 2020

temporary fix :

 let src =  pdf.createLoadingTask({
    url: this.pdfUrl,
    cMapUrl: 'https://cdn.jsdelivr.net/npm/pdfjs-dist@2.5.207/cmaps/',
    cMapPacked: true
  })
4reactions
kakazero7commented, Jul 30, 2021
import { CMapCompressionType } from 'pdfjs-dist/es5/build/pdf.js'

// see https://github.com/mozilla/pdf.js/blob/628e70fbb5dea3b9066aa5c34cca70aaafef8db2/src/display/dom_utils.js#L64
``
export default function() {
    this.fetch = function(query) {
        return import('./buffer-loader!pdfjs-dist/cmaps/' + query.name + '.bcmap' /* webpackChunkName: "noprefetch-[request]" */)
		.then(function(bcmap) {
			delete require.cache[require.resolve('./buffer-loader!pdfjs-dist/cmaps/' + query.name + '.bcmap')]
			return {
				cMapData: bcmap.default,
				compressionType: CMapCompressionType.BINARY
			}
        })
    }
}

complete CMapReaderFactory.js file

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error during font loading: Failed to execute 'postMessage' on ...
Error during font loading : Failed to execute 'postMessage' on 'Worker': ArrayBuffer at index 0 is already detached.
Read more >
Value at index 0 does not have a transferable type - Stack ...
But when the postMessage in the worker code is called, it gives me this error: "Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': ...
Read more >
Using Web Workers - Web APIs - MDN Web Docs
Web Workers are a simple means for web content to run scripts in background threads. The worker thread can perform tasks without interfering ......
Read more >
Node.js v19.3.0 Documentation
Indicates the failure of an assertion. All errors thrown by the node:assert module will be instances of the AssertionError class. new assert.AssertionError( ...
Read more >
Safari Technology Preview Release Notes - Apple Developer
Note: Shared Tab Groups and syncing for Tab Groups, Website Settings, and Web Extensions are not enabled in this release. Web Inspector. Elements...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found