Alcumus / react-doc-viewer

Apache License 2.0
243 stars 103 forks source link

Docx is not working #72

Closed akshayvdongave closed 3 years ago

akshayvdongave commented 3 years ago

Hello, i am trying to show docx type document but it showing error. Screenshot 2021-02-12 194148

for this is used code const docs = [ { uri: "http://localhost:8080/UploadDocs/sampleDoc.docx" }, { uri: "http://localhost:8080/UploadDocs/sampleformat1032.rtf" }, { uri: "http://localhost:8080/UploadDocs/sapmle123.txt" }, { uri: "http://localhost:8080/UploadDocs/143.pdf" } // { uri: require("D:/Apache Software Foundation/Tomcat 8.5/webapps/UploadDocs/143.pdf") }, // Local File ]; return ( <DocViewer pluginRenderers={DocViewerRenderers} documents={docs} /> );

please correct me if wrong or please give solution on it

mattmogford-alcumus commented 3 years ago

Duplicate of #66

akshayvdongave commented 3 years ago

@mattmogford-alcumus can you please give any sample code for custom renderer for docx or any type . in documentation i got for image but i am got get solution for docx. i want to show multiple type of documents so please help me for create custom renderer for docx

mattmogford-alcumus commented 3 years ago

@akshayvdongave A custom renderer in the context of this package is very simple and documented. A custom renderer for Microsoft files is 1000x more complex. The included Microsoft renderers will render uploaded documents , but not local documents.

ilkou commented 3 years ago

this library uses an external service to render documents, this external service cannot recognize local files,

Example:

external-service.com/src=http://localhost:8080/your-file.docx

in this case, the external-service has no access to your local files so u should provide a complete accessible URL, something like:

http://your-website-name:8080/your-file.docx

OR

http://your-IP-address:8080/your-file.docx
MMahendra001ScaleTech commented 2 years ago

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}
        />
AjayIrkal23 commented 1 year ago

i am facing a issue with react-doc-viewer in nextjs i am getting this err

resolve you may need an appropriate loader to handle this file type , currently no loaders are configured to process this file." please help

prem-pachouri-infopro commented 1 year ago

@akshayvdongave This video may help you. https://www.youtube.com/watch?v=E0aK6CKsSNg