react-preview-doc
v1.0.2
Published
Document Preview
Downloads
3
Readme
react-preview-doc
A React component to preview different types of documents
File formats that are supported
pdf, ppt, pptx, doc, docx, xls, xlsx and more
Install
npm install --save react-preview-doc
Usage
// class Component
import React, { Component } from 'react'
import { DocPreview } from 'react-preview-doc'
import 'react-preview-doc/dist/index.css' // optional
class Example extends Component {
render() {
return <DocPreview url='http://example.com/myfile.docx' />
}
}
// functional Component
import React from 'react'
import { DocPreview } from 'react-preview-doc'
const Example = props => {
return <DocPreview url='http://example.com/myfile.docx' />
}
Props
| Prop | Required | Description |
| :----: | :------: | :-------------------------: |
| url | true | file URL |
| style | false | css style ||
| className | false | css class |
| web | false | display an HTML document inside |
License
MIT © jdzl