Closed akshayvdongave closed 3 years ago
Duplicate of #66
@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
@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.
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
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}
/>
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
@akshayvdongave This video may help you. https://www.youtube.com/watch?v=E0aK6CKsSNg
Hello, i am trying to show docx type document but it showing error.
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