-
Notifications
You must be signed in to change notification settings - Fork 0
Converter manual
- What it does
- Parameters
- converter.properties file
- Template
- Use as a command line tool
- Logging
- Command
- Use inside/with another java application
- As library
- Using reflection
- Technical details
The OpenWebslidesConverter is a tool to convert .pptx files into html. The converter does not rebuild the slides with each element on the same place or same size. It is the meaning to interpret the content and create generic code. The information stays the same but it is possible to use another template without changing any code.
You have two choices as output. The first is just raw, plain html code. Secondly, it is also possible to generate code for the shower and a template.
There are a number of parameters.
- input file: must be of the type .pptx or .pdf
- output folder: where the converted file(s) should be placed
- output type: convert to plain code (raw) or with a template and shower (shower)
Values can be set on the command line or within the converter.properties file. If not, default values are used.
A short overview:
| parameter | command line | value | default | |
|---|---|---|---|---|
| input file | -i | *.pptx | *.pdf | required | |
| output dir | -o | * | output | optional |
| output type | -t | raw | shower | raw | optional |
| zip as output | -zip | none | optional |
If the output type (-t) equals shower:
| parameter | command line | |
|---|---|---|
| course | -co | optional |
| chapter | -ch | optional |
The default values can be changed: converter.properties overwrites the default values, the command line arguments overwrite the properties values.
One way to set the values is to create the converter.properties file in the same directory as the converter jar. An example:
#directory for the log file: must end with "\\"
LOG_FILE=c:\\temp\\log\\
#output type: raw or shower
OUTPUT_TYPE=shower
#directory for the converted files
OUTPUT_DIR=converted files
When using shower as output type, a template is used. The template files are stocked in template.zip, which is saved in the package openwebslides inside the builded jar.
There are 2 ways of logging: -cl (console log) and -fl (file log). Console logging shows a short message in case of an error while the log file also contains the stack trace. The default location for the log file is c:\temp\.
There are four possible ways to set the logging:
| flag(s) | logging |
|---|---|
| none | console logging |
| -cl | console logging |
| -fl | file logging |
| -cl -fl | console and file logging |
Adjusting LOG_FILE=... in converter.properties is the only way to change the directory where the log files are created.
$ java -jar OpenWebslidesConverter.jar -i <input file> [options]
Examples:
$ java -jar OpenWebslidesConverter.jar -i file.pptx -t shower -fl
$ java -jar OpenWebslidesConverter.jar -i file.pptx -o "converted files"
$ java -jar OpenWebslidesConverter.jar -i file.pptx -o out -fl -cl
The starting point of the tool is the OpenWebslidesConverter class. It has two entry points:
+ static main(args : String[]) : void+ static queueEntry(args : String[], outputStream : OutputStream, queue : Queue<String>, id : long) : void
queueEntry is a method to get control over the logging inside another project. An empty Queue (java.util.Queue) will be filled in with logging lines. id is used as a unique identification in the logs in case multiple converters are running parallel. The result of the conversion is written as a zip file to the OutputStream. It can be a FileOutputStream, ByteArrayOutputStream ...
The String array args represent in both cases the command line arguments.
Just include the .jar file as a dependency or library inside your project. Use one of the above static methods.
Another way is to load the converter dynamically at runtime using reflection. You can use following code as inspiration.
try {
Queue<String> queue = new ConcurrentLinkedDeque<>();
// Getting the jar URL which contains target class
URL[] classLoaderUrls = ...
// Create a new URLClassLoader
URLClassLoader urlClassLoader = new URLClassLoader(classLoaderUrls);
// Load the target class
Class<?> OpenWebslidesConverter = urlClassLoader.loadClass("openwebslidesconverter.OpenWebslidesConverter");
// Getting a method from the loaded class and invoke it
Method method = OpenWebslidesConverter.getMethod("queueEntry", String[].class, OutputStream.class, Queue.class, long.class);
final Object[] param = new Object[3];
param[0] = args;
param[1] = outputStream;
param[2] = queue;
param[3] = id;
method.invoke(null, param);
... //read the queue or do other work
} catch (...) {
...
}HTML5 only supports three types of video. Those are: MP4, WebM and Ogg. If the video in the PowerPoint file has another extension a placeholder is shown. The original file could still be inserted within the images folder.