As mentioned in the Setting up the worker
section, the worker version has to be the same as the version of the
Otherwise, you you will see the error message like this:
The API version "2.6.347" does not match the Worker version "2.1.266"
The worker version is determined in the
`Worker` component usage:
Whereas the version of
`pdfjs-dist` is found in the
`package.json` file when you install the package:
It isn't convenient and error prone when you upgrade
`pdfjs-dist` but forget to set the same version for the worker.
You can keep both versions in sync to each other by replacing the worker version with the
`pdfjs-dist` version found in the
import packageJson from '../package.json';
const pdfjsVersion = packageJson.dependencies['pdfjs-dist'];