Coder Social home page Coder Social logo

CORS Issues about react-doc-viewer HOT 8 OPEN

alcumus avatar alcumus commented on May 30, 2024 5
CORS Issues

from react-doc-viewer.

Comments (8)

MMahendra001ScaleTech avatar MMahendra001ScaleTech commented on May 30, 2024 4

Okay got it :

Worked this way :
Give fileType
fileType: 'docx'

      const urlData = !!path ? [{ uri: path, fileType: 'docx' }] : [];

        <DocViewer
          className="doc-viewer"
          documents={urlData}
          config={{
            header: {
              disableHeader: false,
              disableFileName: false,
              retainURLParams: false,
            },
          }}
          pluginRenderers={DocViewerRenderers}
        />

from react-doc-viewer.

MMahendra001ScaleTech avatar MMahendra001ScaleTech commented on May 30, 2024

@milinkovitch can you tell me when you were having this cors issues and how did you fixed it.Thanks.

from react-doc-viewer.

hemanth12321 avatar hemanth12321 commented on May 30, 2024

I have the same problem. I'm using sample pdf file and it gives me CORS error in console and the loader for pdf file keeps loading forever. Ideally it should display error message - Couldn't load pdf file.
const docs = [ { uri: "http://www.africau.edu/images/default/sample.pdf", fileType: "pdf", }, ];

from react-doc-viewer.

hienfree avatar hienfree commented on May 30, 2024

same

from react-doc-viewer.

Vlad1999 avatar Vlad1999 commented on May 30, 2024

I have the same problem, please help!!!

image
image

from react-doc-viewer.

Oreanu avatar Oreanu commented on May 30, 2024

All you need to do is pass in the fileType and URI, I had the same issue but got it working by passing only these two. I was previously passed the URI only

from react-doc-viewer.

abdnafees avatar abdnafees commented on May 30, 2024

fileType guys, fileType. It's a must.

from react-doc-viewer.

yusuffadil avatar yusuffadil commented on May 30, 2024
import DocViewer, { PDFRenderer } from "react-doc-viewer";

const show = () => {

    const docs = [
        { uri: "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf", fileType: "pdf", },
    ];

    return <DocViewer documents={docs} pluginRenderers={[PDFRenderer]} />

}

export default show

use this still cors

from react-doc-viewer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.