Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

local files not rendering #126

Open
syatom opened this issue Jul 20, 2023 · 2 comments
Open

local files not rendering #126

syatom opened this issue Jul 20, 2023 · 2 comments

Comments

@syatom
Copy link

syatom commented Jul 20, 2023

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.

@mustafasavul
Copy link

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.

@an0nym3sh
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants