Skip to content

JThumbnail

JThumbnail is a Java library for creating Thumbnails of common types of file including .doc, .docx, .pdf , .mp4 etc. full list

  • Project is under development!
  • Check the v1 branch for Java 8 compatible version.
  • Check the dev/** branches for latest commits on different under development version.
  • Check the release/** branches for stable release versions
  • master branch will always point to the latest available release version

Project Source: https://github.com/makbn/JThumbnail

How to use

String[] args = new String[]{};
JThumbnailer jThumbnailer = JThumbnailerStarter.init(args);
File in = new File("/inputFile.docx");
ThumbnailCandidate candidate = new ThumbnailCandidate(in,"unique_code");
jThumbnailer.run(candidate, new ThumbnailListener() {
@Override
public void onThumbnailReady(String hash, File thumbnail) {
Files.copy(thumbnail.toPath(), Path.of("my_thumbnail_folder", thumbnail.getName()), StandardCopyOption.REPLACE_EXISTING);
}
@Override
public void onThumbnailFailed(String hash, String message, int code) {
// handle the situation
}
});
// close thumbnailer
jThumbnailer.close();

Configuration Args

Configuration ArgsDescription
OPENAPI Properties
JTHUMBNAILER_OPENAPI_NAMEApplication name, e.g. Java Thumbnail Generator in Swagger UI
JTHUMBNAILER_OPENAPI_DESCDescription of the application in Swagger UI
JTHUMBNAILER_OPENAPI_LICENSELicense of the application as displayed in Swagger UI
JTHUMBNAILER_OPENAPI_URLURL pointing to the license text for Swagger UI
OPENOFFICE Properties
JTHUMBNAILER_OPENOFFICE_PORTSPorts used by OpenOffice for document conversion
JTHUMBNAILER_OPENOFFICE_TIMEOUTTimeout for OpenOffice document conversion tasks
JTHUMBNAILER_OPENOFFICE_MAX_TASKS_PER_PROCESSMaximum number of conversion tasks allowed per OpenOffice process
JTHUMBNAILER_OPENOFFICE_OFFICE_HOMEDirectory path to the OpenOffice installation
JTHUMBNAILER_OPENOFFICE_WORKING_DIRWorking directory path for OpenOffice
JTHUMBNAILER_OPENOFFICE_TMP_DIRDirectory path for temporary files generated and used by OpenOffice
THUMBNAIL Properties
JTHUMBNAILER_THUMBNAIL_THUMB_WIDTHWidth of generated thumbnails
JTHUMBNAILER_THUMBNAIL_THUMB_HEIGHTHeight of generated thumbnails
ASYNC Properties
JTHUMBNAILER_ASYNC_CORE_POOL_SIZECore pool size for the asynchronous processing tasks
JTHUMBNAILER_ASYNC_MAX_POOL_SIZEMaximum pool size for the asynchronous processing tasks
SERVER Properties
JTHUMBNAILER_SERVER_UPLOAD_DIRECTORYDirectory used to store uploads when using API
JTHUMBNAILER_SERVER_MAX_WAITING_LIST_SIZEQueue for files to be processed
SPRING
SPRING_SERVLET_MULTIPART_MAX_FILE_SIZEMaximum allowed file size for multipart file uploads
SPRING_SERVLET_MULTIPART_MAX_REQUEST_SIZEMaximum allowed request size for multipart file uploads
SERVER_PORTPort on which the Web application will be hosted
SPRING DOC
SPRINGDOC_API_DOCS_PATHPath for accessing the API documentation in JSON format
SPRINGDOC_SWAGGER_UI_PATHPath for accessing the Swagger UI for interactive API documentation
  • All parameters can be passed through environment variables. To pass a param as environment variable you need to replace the dots with underscore and use uppercase. For example, jthumbnailer.openoffice.office_home should be JTHUMBNAILER_OPENOFFICE_OFFICEHOME (see Spring documentation.

Requirements

  • Java JRE 21
  • OpenOffice >4.x or LibreOffice >7.x

Supported File Formats

  • Office files (doc, docx, xls, xlsx, ppt, pptx)
    • There is a problem with most xlsx files
  • OpenOffice files (all of them)
  • Text files (txt, pdf, rtf, html)
  • Image files (jpg, png, bmp, gif)
  • AutoCad files (dwg)
  • MP3 files (user album-art as thumbnail)
  • MPEG files (generate gif file)

Adding Repository

Packages are currently published on Github Registry.Please read this document for more information on using them.

Maven

Step 1. Add the dependency to the pom file:

<dependency>
<groupId>io.github.makbn</groupId>
<artifactId>jthumbnail</artifactId>
<version>2.2.2</version>
</dependency>

Gradle

Step 1. Add the dependency to the build.gradle file:

compile "io.github.makbn:jthumbnail:2.2.2"

TODO

All the tasks and features that are planned to be implemented are moved to the Project board!

Contributing

Contributions are welcome! Please read the contributing guidelines, Code of Conduct, and CLA before opening issues or pull requests.

Original project

JThumbnail is based on an old project of the university of Siegen for the benefit of come_IN Computerclubs. and thanks a lot to @benjaminpick

About

A thumbnail generation Java library for Office,PDF,HTML,Text,MP3,MPEG and Image documents

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

41 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages