Environmental requirements
Must be a Windows computer with Microsoft Office installed and activated.
Import Jar
First introduce the jar package in the pom
<dependency>
<groupId>cc.pptshow</groupId>
<artifactId>pptshow</artifactId>
<version>1.3</version>
</dependency>
write test code
This jar package has encapsulated this method and can be used directly
PPTUtil.PPT2MP4(String pptPath, String mp4Path)
The first parameter is the PPT file address
The second parameter is the path of the mp4 file that needs to be generated
Due to system reasons, parallel generation is currently not supported
Notice:
- The system must have installed and activated Microsoft Office
- Windows system only
- During the generation process, there may be an abnormality in the Office software that may cause the conversion to fail, so be sure to test that your Office is not a lite version, only if you have this function!
compressed MP4
The generated video is generally relatively large (more than 100M), and generally we need to use it after compression
Compression requires that ffmeng has been installed on our computer and the environment variables have been configured
PPTUtil.mp4Compression(String bigMp4Path, String smallMp4Path)
bigMp4Path: MP4 file generated by PPT2MP4 method
smallMp4Path: The storage path of the reduced file, ending in .mp4, does not support overwriting, and there must be no file in this path
The MP4 file generated by compression is automatically compressed into a 1280x720 video with 15 frames. Generally, the 25-page PPT video is about 20MB after compression
Notice:
- It is necessary to install ffmeng on the computer and add environment variables
- Adjustment parameters are not currently supported
Tips
Support animation operations (both element animation and page change animation are supported)
Support Chinese fonts, no need to convert fonts in advance (provided that the fonts are installed on the computer)