Document online preview project solution, built using the popular Spring Boot framework for easy setup and deployment. This versatile open source project provides basic support for a wide range of document formats, including:
- Supports Office documents such as
doc,docx,xls,xlsx,xlsm,ppt,pptx,csv,tsv, ,dotm,xlt,xltm,dot,xlam,dotx,xla,,pages,pptmetc. - Supports domestic WPS Office documents such as
wps,dps,et,ett,wpt. - Supports OpenOffice, LibreOffice office documents such as
odt,ods,ots,odp,otp,six,ott,fodtandfods. - Supports Visio flowchart files such as
vsd,vsdx. - Supports Windows system image files such as
wmf,emf. - Supports Photoshop software model files such as
psd,eps. - Supports document formats like
pdf,ofd, andrtf. - Supports software model files like
xmind. - Support for
bpmnworkflow files. - Support for
eml,msgmail files - Support for
epubbook documents - Supports 3D model files like
obj,3ds,stl,ply,gltf,glb,off,3dm,fbx,dae,wrl,3mf,ifc,brep,step,iges,fcstd,bim, etc. - Supports CAD model files such as
dwg,dxf,dwfiges,igs,dwt,dng,ifc,dwfx,stl,cf2,plt, etc. - Supports all plain text files such as
txt,xml(rendering),md(rendering),java,php,py,js,css, etc. - Supports compressed packages such as
zip,rar,jar,tar,gzip,7z, etc. - Supports image previewing (flip, zoom, mirror) of
jpg,jpeg,png,gif,bmp,ico,jfif,webp,heic, ,heifetc. - Supports image information model files such as
tifandtiff. - Supports image format files such as
tga. - Supports vector image format files such as
svg. - Supports
mp3,wav,mp4,flv. - Supports many audio and video format files such as
avi,mov,wmv,mkv,3gp, andrm. - Supports for
dcm. - Supports for
drawio.
- Build with the popular frame spring boot
- Easy to build and deploy
- Basically support online preview of mainstream office documents, such as Doc, docx, Excel, PDF, TXT, zip, rar, pictures, etc
- REST API
- Abstract file preview interface so that it is easy to extend more file extensions and develop this project on your own
Please treat public service kindly, or this would stop at any time.
We will answer your questions carefully and solve any problems you encounter while using the project. We also kindly ask that you at least Google or Baidu before asking questions in order to save time and avoid ineffective communication. Let's cherish our lives and stay away from ineffective communication.
Technology stack
- Spring boot: spring boot Development Reference Guide
- Freemarker
- Redisson
- Jodconverter
Dependencies
- Redis(Optional, Unnecessary by default)
- OpenOffice or LibreOffice(Integrated on Windows, will be installed automatically on Linux, need to be manually installed on Mac OS)
-
First step:
git pull https://github.com/kekingcn/kkFileView.git -
second step:Run the main method of
/server/src/main/java/cn/keking/ServerMain.java. After starting,visithttp://localhost:8012/.
- Enhanced xlsx front-end parsing - Improved Excel file front-end rendering performance
- Optimized image parsing - Enhanced image processing mechanism
- Improved tif parsing - Enhanced TIF format support
- Enhanced svg parsing - Optimized SVG vector image rendering
- Improved json parsing - Enhanced JSON file processing
- Optimized ftp multi-client access - Improved FTP service compatibility
- Enhanced home page directory access - Implemented post server-side pagination mechanism
- Improved marked parsing - Enhanced Markdown rendering
- msg email parsing - Added support for msg format email file preview
- heic image parsing - Added support for HEIC format image preview
- Cross-domain methods - Added cross-domain processing mechanism
- Highlighting methods - Added text highlighting functionality
- Pagination methods - Added document page control
- AES encryption methods - Added AES encryption support
- Basic authentication methods - Added Basic authentication mechanism
- Key management methods - Added key management functionality
- Anti-duplicate conversion - Added duplicate file conversion protection
- Async waiting - Added asynchronous processing mechanism
- Upload restrictions - Added restrictions for unsupported file uploads
- cadviewer conversion methods - Added CAD viewer conversion functionality
- Compressed file path issues - Fixed internal path handling in compressed files
- Security issues - Fixed security vulnerabilities
- Incomplete image watermark issues - Fixed incomplete watermark display
- SSL self-signed certificate access issues - Fixed compatibility with self-signed certificates
- JDK version requirement - Mandatory requirement for JDK 21 or higher
- pdf front-end parsing update - Upgraded PDF front-end rendering component
- odf front-end parsing update - Upgraded ODF document front-end rendering
- 3D model front-end parsing update - Upgraded 3D model viewer
- pdf backend async conversion optimization - Implemented multi-threaded asynchronous conversion
- tif backend async conversion optimization - Implemented multi-threaded asynchronous conversion
- Video backend async conversion optimization - Implemented multi-threaded asynchronous conversion
- CAD backend async conversion optimization - Implemented multi-threaded asynchronous conversion
- xlsx printing support
- Added GZIP compression enablement in configuration
- CAD format now supports conversion to SVG and TIF formats, added timeout termination and thread management
- Added captcha verification for file deletion
- Added xbrl format preview support
- PDF preview added control over signatures, drawings, illustration control, search positioning pagination, and display content definition
- Added CSV format front-end parsing support
- Added Docker image support for ARM64
- Added Office preview conversion timeout property setting
- Added preview file host blacklist mechanism
- Optimized OFD mobile preview page adaptability
- Updated xlsx front-end parsing component to accelerate parsing speed
- Upgraded CAD component
- Office function adjustments, supporting comments, conversion page limit, watermark generation, etc.
- Upgraded markdown component
- Upgraded dcm parsing component
- Upgraded PDF.JS parsing component
- Changed video player plugin to ckplayer
- Smarter tif parsing, supporting modified image formats
- Improved character encoding detection accuracy for large and small text files, handling concurrency vulnerabilities
- Refactored file download code, added general file server authentication access design
- Updated bootstrap component and streamlined unnecessary files
- Updated epub version, optimized epub display effect
- Fixed issue where scheduled cache cleanup only deleted disk cache files for multimedia file types
- Auto-detection of installed Office components, added default paths for LibreOffice 7.5 & 7.6 versions
- Changed drawio default to preview mode
- Added PDF thread management, timeout management, memory cache management, updated PDF parsing component version
- Optimized Dockerfile for true cross-platform image building
- Fixed forceUpdatedCache property setting issue where local cache files weren't updated
- Fixed PDF decryption error after successful encrypted file conversion
- Fixed BPMN cross-domain support issue
- Fixed special character error in compressed package secondary reverse proxy
- Fixed video cross-domain configuration causing video preview failure
- Fixed TXT text pagination secondary loading issue
- Fixed Drawio missing Base64 component issue
- Fixed Markdown escaping issue
- Fixed EPUB cross-domain error
- Fixed URL special character issues
- Fixed compressed package traversal vulnerability
- Fixed compressed file path errors, image collection path errors, watermark issues, etc.
- Fixed front-end parsing XLSX containing EMF format file errors
- Added DCM medical digital imaging preview
- Added drawio drawing preview
- Added command to regenerate with cache enabled: &forceUpdatedCache=true
- Added dwg CAD file preview
- Added PDF file password support
- Added DPI customization for PDF file image generation
- Added configuration to delete converted OFFICE, CAD, TIFF, compressed package source files (enabled by default to save disk space)
- Added front-end xlsx parsing method
- Added support for pages, eps, iges, igs, dwt, dng, ifc, dwfx, stl, cf2, plt and other formats
- Modified generated PDF file names to include file extensions to prevent duplicate names
- Adjusted SQL file preview method
- Optimized OFD preview compatibility
- Beautified TXT text pagination box display
- Upgraded Linux/Docker built-in office to LibreOffice-7.5.3
- Upgraded Windows built-in office to LibreOffice-7.5.3 Portable
- Other functional optimizations
- Fixed compressed package path errors in reverse proxy scenarios
- Fixed .click error when image preview URLs contain &
- Fixed known OFD preview issues
- Fixed page error when clicking on file directories (tree nodes) in compressed package preview
- Other known issue fixes
- Fixed null pointer bug in dwg file preview
- Added SVG format file preview support
- Added encrypted Office file preview support
- Added encrypted zip, rar, and other compressed package file preview support
- Added xmind software model file preview support
- Added BPMN workflow model file preview support
- Added eml email file preview support
- Added EPUB e-book file preview support
- Added office document format support: dotm, ett, xlt, xltm, wpt, dot, xlam, xla, dotx, etc.
- Added 3D model file support: obj, 3ds, stl, ply, gltf, glb, off, 3dm, fbx, dae, wrl, 3mf, ifc, brep, step, iges, fcstd, bim, etc.
- Added configurable high-risk file upload restrictions (e.g., exe files)
- Added configurable site filing information
- Added password requirement for demo site file deletion
- Added caching for text document preview
- Beautified 404, 500 error pages
- Optimized invoice and other OFD file preview seal rendering compatibility
- Removed office-plugin module, using new jodconverter component
- Optimized Excel file preview effect
- Optimized CAD file preview effect
- Updated xstream, junrar, pdfbox, and other dependency versions
- Updated TIF to PDF conversion plugin, added conversion cache
- Optimized demo page UI deployment
- Compressed package file preview supports directories
- Fixed XSS issues in some interfaces
- Fixed console printed demo address not following content-path configuration
- Fixed OFD file preview cross-domain issues
- Fixed internal self-signed certificate HTTPS URL file download issues
- Fixed special character file deletion issues
- Fixed OOM caused by unreclaimed memory in PDF to image conversion
- Fixed garbled preview for xlsx 7.4+ version files
- Fixed TrustHostFilter not intercepting cross-domain interfaces (security issue - upgrade required if using TrustHost)
- Fixed compressed package file preview filename garbled issue on Linux systems
- Fixed OFD file preview only displaying 10 pages
December 14, 2022, version 4.1.0 released:
- Updated homepage design by @wsd7747.
- Compatible with multipage tif for pdf and jpg conversion and multiple page online preview for tif image preview by @zhangzhen1979.
- Optimized docker build, using layered build method by @yl-yue.
- Implemented file encryption based on userToken cache by @yl-yue.
- Implemented preview for encrypted Word, PPT, and Excel files by @yl-yue.
- Upgraded Linux & Docker images to LibreOffice 7.3.
- Updated OFD preview component, tif preview component, and added support for PPT watermarking.
- Numerous other upgrades, optimizations, and bug fixes. We thank @yl-yue, @wsd7747, @zhangzhen1979, @tomhusky, @shenghuadun, and @kischn.sun for their code contributions.
July 6, 2021, version 4.0.0 released:
- The integration of OpenOffice in the underlying system has been replaced with LibreOffice, resulting in enhanced compatibility and improved preview effects for Office files.
- Fixed the directory traversal vulnerability in compressed files.
- Fixed the issue where previewing PPT files in PDF mode was ineffective.
- Fixed the issue where the front-end display of image preview mode for PPT files was abnormal.
- Added a new feature: the file upload function on the homepage can be enabled or disabled in real-time through configuration.
- Optimized the logging of Office process shutdown.
- Optimized the logic for finding Office components in Windows environment, with built-in LibreOffice taking priority.
- Optimized the synchronous execution of starting Office processes.
June 17, 2021, version 3.6.0 released:
This version includes support for OFD file type versions, and all the important features in this release were contributed by the community. We thank @gaoxingzaq and @zhangxiaoxiao9527 for their code contributions.
- Added support for previewing OFD type files. OFD is a domestically produced file format similar to PDF.
- Added support for transcoding and previewing video files through ffmpeg. With transcoding enabled, theoretically, all mainstream video file formats such as RM, RMVB, FLV, etc. are supported for preview.
- Beautified the preview effect of PPT and PPTX file types, much better looking than the previous version.
- Updated the versions of dependencies such as pdfbox, xstream, common-io.
January 28, 2021:
The final update of the Lunar New Year 2020 has been released, mainly including some UI improvements, bug fixes reported by QQ group users and issues, and most importantly, it is a new version for a good year.
- Introduced galimatias to solve the problem of abnormal file download caused by non-standard file names.
- Updated UI style of index access demonstration interface.
- Updated UI style of markdown file preview.
- Updated UI style of XML file preview, adjusted the architecture of text file preview to facilitate expansion.
- Updated UI style of simTxT file preview.
- Adjusted the UI of continuous preview of multiple images to flip up and down.
- Simplified all file download IO operations by adopting the apache-common-io package.
- XML file preview supports switching to pure text mode.
- Enhanced prompt information when url base64 decoding fails.
- Fixed import errors and image preview bug.
- Fixed the problem of missing log directory when running the release package.
- Fixed the bug of continuous preview of multiple images in the compressed package.
- Fixed the problem of no universal matching for file type suffixes in uppercase and lowercase.
- Specified the use of the Apache Commons-code implementation for Base64 encoding to fix exceptions occurring in some JDK versions.
- Fixed the bug of HTML file preview of text-like files.
- Fixed the problem of inability to switch between jpg and pdf when previewing dwg files.
- Escaped dangerous characters to prevent reflected xss.
- Fixed the problem of duplicate encoding causing the failure of document-to-image preview and standardized the encoding.
December 27, 2020:
The year-end major update of 2020 includes comprehensive architecture design, complete code refactoring, significant improvement in code quality, and more convenient secondary development. We welcome you to review the source code and contribute to building by raising issues and pull requests.
- Adjusted architecture modules, extensively refactored code, and improved code quality by several levels. Please feel free to review.
- Enhanced XML file preview effect and added preview of XML document structure.
- Added support for markdown file preview, including support for md rendering and switching between source text and preview.
- Switched the underlying web server to jetty, resolving the issue: #168
- Introduced cpdetector to solve the problem of file encoding recognition.
- Adopted double encoding with base64 and urlencode for URLs to completely solve preview problems with bizarre file names.
- Added configuration item office.preview.switch.disabled to control the switch of office file preview.
- Optimized text file preview logic, transmitting content through Base64 to avoid requesting file content again during preview.
- Disabled the image zoom effect in office preview mode to achieve consistent experience with image and pdf preview.
- Directly set pdfbox to be compatible with lower version JDK, and there will be no warning prompts even when run in IDEA.
- Removed non-essential toolkits like Guava and Hutool to reduce code volume.
- Asynchronous loading of Office components speeds up application launch to within 5 seconds.
- Reasonable settings of the number of threads in the preview consumption queue.
- Fixed the bug where files in compressed packages failed to preview again.
- Fixed the bug in image preview.
May 20th 2020 :
- Support for global watermark and dynamic change of watermark content through parameters
- Support for CAD file Preview
- Add configuration item base.url, support using nginx reverse proxy and set context-path
- All configuration items can be read from environment variables, which is convenient for docker image deployment and large-scale use in cluster
- Support the configuration of TrustHost (only the file source from the trust site can be previewed), and protect the preview service from abuse
- Support configuration of customize cache cleanup time (cron expression)
- All recognizable plain text can be previewed directly without downloading, such as .md .java .py, etc
- Support configuration to limit PDF file download after conversion
- Optimize Maven packaging configuration to solve the problem of line break in .sh script
- Place all CDN dependencies on the front end locally for users without external network connection
- Comment Service on home page switched from Sohu ChangYan to gitalk
- Fixed preview exceptions that may be caused by special characters in the URL
- Fixed the addtask exception of the transformation file queue
- Fixed other known issues
- Official website build: https://kkview.cn
- Official docker image repository build: https://hub.docker.com/r/keking/kkfileview
June 18th 2019 :
- Support automatic cleaning of cache and preview files
- Support http/https stream url file preview
- Support FTP url file preview
- Add Docker build
April 8th 2019
- Cache and queue implementations abstract, providing JDK and REDIS implementations (REDIS becomes optional dependencies)
- Provides zip and tar.gz packages, and provides a one-click startup script
January 17th 2018
- Refined the project directory, abstract file preview interface, Easy to extend more file extensions and depoly this project on your own
- Added English documentation (@幻幻Fate,@汝辉) contribution
- Support for more image file extensions
- Fixed the issue that image carousel in zip file will always start from the first
January 12th 2018
- Support for multiple images preview
- Support for images rotation preview in rar/zip
January 2nd 2018
- Fixed gibberish issue when preview a txt document caused by the file encoding problem
- Fixed the issue that some module dependencies can not be found
- Add a spring boot profile, and support for Multi-environment configuration
- Add
pdf.jsto preview the documents such as doc,etc.,support for generating doc headlines as pdf menu,support for mobile preview
If this project has been helpful to you, we welcome your sponsorship. Your support is our greatest motivation.!