cyntler / react-doc-viewer

File viewer for React.
https://cyntler.github.io/react-doc-viewer
Apache License 2.0
361 stars 125 forks source link

Not able use the package in react #276

Closed itsCheithanya closed 2 months ago

itsCheithanya commented 2 months ago

when running npm start the compiler throws this error image

cyntler commented 2 months ago

@itsCheithanya More informations I need to can help. What kind of files are you trying to render? Paste here some of your code.

itsCheithanya commented 2 months ago

I was using node version 14 maybe that's why it didn't work , I updated the node to version 20 its working now and one more thing the code doesn't preview local docx and pptx files image

import DocViewer, { DocViewerRenderers } from "react-doc-viewer";
import "@cyntler/react-doc-viewer/dist/index.css";

function App() {
  const docs = [
    { uri: require("./POSTER-2024_NO-FUND_Final.docx") },
  ];

  return <DocViewer documents={docs} pluginRenderers={DocViewerRenderers} />;
}
export default App;
cyntler commented 2 months ago

@itsCheithanya OK, so now your problem is what is described here: https://github.com/cyntler/react-doc-viewer?tab=readme-ov-file#important-note. So sorry but your local docx and pptx files can't be rendered. They must be public with access URL.