plangrid / react-file-viewer

MIT License
515 stars 332 forks source link

RTF support #147

Open DevCraftsmanShubham opened 4 years ago

DevCraftsmanShubham commented 4 years ago

How i can, show the rtf file, i did't get how to extend the rtf and how to show the rtf file.

mparupat commented 4 years ago

Are you able to import and use the component for PDF, Image and Doc preview with in React application. I am facing problem importing the package, would appreciate your help.

DevCraftsmanShubham commented 4 years ago

Are you able to import and use the component for PDF, Image and Doc preview with in React application. I am facing problem importing the package, would appreciate your help.

I tried this for pdf and this is working fine for me

import FileViewer from 'react-file-viewer';
import { CustomErrorComponent } from 'custom-error';
const file = 'pdf_url'
const type = 'pdf'

class App extends Component {

 onError(e) {
    logger.logError(e, 'error in file-viewer');
  }
  render() {

    return (
      <FileViewer
        fileType={type}
        filePath={file}
        errorComponent={CustomErrorComponent}
        onError={this.onError}/>
    );
  }
}
mparupat commented 4 years ago

I used create react app, to create my project its giving me memory heap error. I am not understanding if problem is with virsion of file viewer or if i missed to add any dependencies . Can you send the dependencies that you have in package.json. just to check if i have missed any dependency.

DevCraftsmanShubham commented 4 years ago

I used create react app, to create my project its giving me memory heap error. I am not understanding if problem is with virsion of file viewer or if i missed to add any dependencies . Can you send the dependencies that you have in package.json. just to check if i have missed any dependency.

Annotation 2020-04-23 215656

mparupat commented 4 years ago

Thank you for your input, it still didn't work for me. The moment i import react-file-viewer compiler is throwing error for me.

image

imdeepmind commented 4 years ago

@mparupat change the import to this import FileViewer from "react-file-viewer";