Giter VIP home page Giter VIP logo

file-viewer's Introduction

File Viewer

This is a custom element (web component - can be used every where regardless the framework) built with Svelte to view files. Demo

Usage

url - File link.

filename - the file name - should include the file extension.

<file-viewer
    filename="some-excel-file.xlsx"
    url="https://link.com"
></file-viewer>
<file-viewer
    filename="some-not-supported-file.not-supported"
    url="https://link.com"
>
    <div slot="not-supported">
        ๐Ÿ˜•
    </div>
</file-viewer>

Available slot:

  • not-supported - Given file extension is not supported.

Available events:

  • onload - iframe onload event.

Supported File Extensions

.ppt, .pptx, .doc, .docx, .xls, .xlsx, .pdf, .png, .jpg, .jpeg, .gif,

Examples:

file-viewer's People

Contributors

avipunes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

file-viewer's Issues

Office files cannot be displayed

Hi, Does this library have a problem with Digital Ocean servers? Because my Office file is on the DO server it can't be displayed with the message "An error occurred
We're sorry, but for some reason we can't open this for you. "

However, only Office files cannot appear.

Is there a solution for that?

excel xlsx File extension is not supported.

import "file-viewer";
...file-viewer filename="filename" url="url"... // remove </ because of formatting

for some reason .xlsx is rendering as File extension is not supported. Please help to resolve this. There isnt any error in the console too.

how to import this into react

Hi, I have imported this to react app but due to the hypen it's showing an error.

import {file-viewer} from "file-viewer";

Please help on this. Thanks

Size file

What is the maximum file size that can be displayed using this library?

How to load url dynamically in vue?

Hi @avipunes, In my application, I wanted to load file-viewer URL dynamically. Below is my code:

<file-viewer id="file-viewer" :filename="fileName" :url="src"
          style="overflow: auto; height: 600px;width: 750px; position: absolute;"></file-viewer>

This code is not working for a dynamic URL, like if I have 10 files in my directory and I wanted to load file one by one by clicking on the file. My code is generating a dynamic URL for each file, but unable to load.
Thanks!!

React 17

For some reason this package does not work with react 17
CleanShot 2020-11-09 at 21 26 40@2x

it works with React 16 and CRA 3

codesandbox

p.s i'm using it with next.js by the way

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.