前端技术实现文件预览(word、excel、pdf、图片、文本)

category
Web
date
Jan 12, 2023
icon
slug
file-preview
status
Published
summary
终成
tags
React
JavaScript
type
Post
文档类型
npm包
pdf
pdfjs-dist
docx
docx-preview
xlsx
exceljs、handsontable、@handsontable/react
gif, jpg, jpeg, bmp, tiff, tif, png, svg
自身
txt, md 等文本格式
自身

Buffer的获取

请求

本地

通过 input file
readBuffer

文件处理

Docx

getDocumentRatio

PDF

Excel

Image

readDataURL

Text

readText
 

文件

 

参考链接:

  1. https://zhuanlan.zhihu.com/p/490014449
 

© JinSo 2021 - 2026