Alcumus/react-doc-viewer

local files not rendering

Opened this issue · 2 comments

syatom commented

HI, I am trying to render a local file and get an error see below the code I am using and error message.

`import DocViewer from "react-doc-viewer";
//import EOC_test.pdf from "./assets/testDocs/";

function App() {
const docs = [
{
uri: "./assets/testDocs/EOC-test.pdf",
},
];
return ;
}

export default App;`

I have omitted the required as get an error saying required is not defined.

image

I just get a constant spinner.

image

If you need anymore info let me know.

const docs = [
    {
      uri: "https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf",
      fileType: "pdf",
      fileName: "macos.pdf"
    },
    {
        uri: process.env.PUBLIC_URL + "/testFile/file-sample_100kB.doc",
        fileType: "doc",
        fileName: "sample.doc"
    },
];

process.env.PUBLIC_URL standart react setup root public folder.

vs code online pdf doesnt work because you use local server. Open CORS extension this url working.

I use that this way. This code working me localy but not render docx,doc,xls just opened pdf & image format. I trying publish vercel maybe it works online.

Do you know if it will work with a payload containing blob of excel?