react-pdf icon indicating copy to clipboard operation
react-pdf copied to clipboard

Document cannot be rendered after update to v9.0.0

Open pk-bt opened this issue 3 weeks ago • 10 comments

Before you start - checklist

  • [X] I followed instructions in documentation written for my React-PDF version
  • [X] I have checked if this bug is not already reported
  • [X] I have checked if an issue is not listed in Known issues
  • [X] If I have a problem with PDF rendering, I checked if my PDF renders properly in PDF.js demo

Description

After the latest update I started to get the following errors:

Unbenannt

I am using cra.

Steps to reproduce

I am importing the module and the pdf worker as following:

import {Document, Page, pdfjs} from "react-pdf";
import 'react-pdf/dist/esm/Page/AnnotationLayer.css';
import 'react-pdf/dist/esm/Page/TextLayer.css';
import "./PDFViewer.scss";
import {TextItem} from "pdfjs-dist/types/src/display/api";
import {DocumentCallback} from "react-pdf/src/shared/types";

pdfjs.GlobalWorkerOptions.workerSrc = new URL(
    'pdfjs-dist/build/pdf.worker.min.mjs',
    import.meta.url,
).toString();

const options = {
    cMapUrl: '/cmaps/',
    standardFontDataUrl: '/standard_fonts/',
};

...

Expected behavior

No errors.

Actual behavior

The PDF document cannot be opened.

Additional information

No response

Environment

  • Browser (if applicable): Chrome Android;
  • React-PDF version: 9.0.0;
  • React version: 18.2.0;
  • Webpack version (if applicable): 5.91.0;

pk-bt avatar Jun 10 '24 12:06 pk-bt