In this issue, we recommend a tool that supports file format conversion to convert multiple formats to PDF format – docpreview.
docpreview is a tool that can convert a variety of file formats to pdf and image formats, and supports online preview display. THE FUNCTIONS THAT HAVE BEEN IMPLEMENTED ARE: MULTI-FORMAT TO PDF FORMAT, OFFICE TO PNG FORMAT, ONLINE PREVIEW FILE, MOBILE PREVIEW VIEW FILE.
Formats that support conversion
Image preview:.gif, bmp, jpeg, jpg, png, and ico
Document preview:.doc, docx, xls, xlsx, ppt, pptx
PDF file: pdf
Text file: txt
Audio files: mp3, ogg, wav
Video files: mp4, webm, mkv
Online Demo
Address:
http://up.icuapi.com/index
How it works
Install LibreOffice
LibreOffice is installed in the environment where the program is running, and PDF conversion is done based on LibreOffice (OpenOffice is also available).
LibreOffice Installation Tutorial:
http://wiki.nooss.cn/archives/420.html
Linux installation font (garbled characters will occur if not installed):
http://wiki.nooss.cn/archives/406.html
Package the source code
Code Address:
https://gitee.com/hcwdc/docpreview
Copy the files from the source code and add them to your own code
Package this demo as a jar and introduce it into your own project
API introduction
File upload
http://ip:port/demo/upload
Convert files to PDF
The file is converted to PDF first, and then converted to image using PDFBOX.
http://ip:port/demo/toPdf
Parameter configuration
castle:
upload:
# Configure the accessible path by yourself
fileDomain: http://up.hcses.cn/pdftools # The address where the file can be accessed
fileServerPath: /www/wwwroot/up.hcses.cn/pdftools/ # The server storage location of the original file
This project uses the MIT open source license, and you can read more about it by yourself.