Java Interface

This interface allows Docx to HTML Converter of OSDC V10.0 to be invoked from Java programs. version 11 or later. See Java VM Issues.

The Java Interface uses JNI (JavaNativeInterface).

Library Files

The following library files are included in [Install directory] or [Install directory]/​lib.

Library file Contents Location
SbhJavaCtl.jarJava Archive [Install directory]/​lib
SbhJavaCtl100.dllJava Interface Library for Windows [Install directory]
libSbhJavaCtl100.soJava Interface Library for Linux [Install directory]/​lib

In order to execute the Java Interface, directory of execute java and [Install directory]/​lib/​SbhJavaCtl.jar must be included in the CLASSPATH environment variable. In addition, from using JNI (JavaNativeInterface), in Windows version, [Install directory] must be included in the PATH environment variable. In the following environment, [Install directory]/​lib must be included. In Linux version, it must be included in the LD_LIBRARY_PATH environment variable. See also Environment Variables and Symbolic Links for the necessary environment variables.

Windows version:

> set CLASSPATH=[Install directory]/lib/SbhJavaCtl.jar;%CLASSPATH% > set PATH=[Install directory];%PATH%

Linux version:

$ CLASSPATH=[Install directory]/lib/SbhJavaCtl.jar:${CLASSPATH} $ export CLASSPATH $ LD_LIBRARY_PATH=[Install directory]/lib:${LD_LIBRARY_PATH} $ export LD_LIBRARY_PATH

Java VM Issues

Java Interface is built using Eclipse Temurin JDK (Former AdoptOpenJDK) 11. Java runtime environments below Java 11 are not supported. Additionally using Java execution of an old version in the Linux environment could cause compatibility issues.

Using the interface in an application server

Since the native JNI library can be read by two or more Java VM class loaders, when using this interface in application servers, such as Tomcat, do not install the SbhJavaCtl.jar in the WEB-INF/lib of the Web application. Set the interface to be read by class loaders (system class loader etc.) which only load once.

Classes

The following classes are contained in the Java interface:

Name Functions
SbhObj Docx to HTML Converter of OSDC V10.0 class (itself). SbhObj
import jp.co.antenna.SbhJavaCtl.*; SbhObj obj; try { obj = new SbhObj(); // some process catch(Exception e) { System.out.println(e.getMessage()); }

Methods

SbhObj Class provides the following methods:

Name Return Value Arguments Functions
execute None None Executes the conversion and outputs to the destination specified in setDocumentURI .
setDocumentURI None newVal : java.lang.String Specify the input file name.
setOutputFilePath None newVal : java.lang.String Specify the output file name.
clrSettings None None Cleares option settings.
lodeSettings None newVal : java.lang.String Loads specified option setting file.
setEnableXHTML None newVal : boolean Specifies the grammar for tag output.
newValIf "true", specified XML grammar. If "faulse", specified HTML grammar.
setViewportContent None content : java.lang.String Specifies to output the meta tag in the following format in the <head>.
<meta name="viewport" content=" Content specified in ‘content’">
setEnableENDL None newVal : boolean Specifies whether to output a line break at the end of the block tag. newValIf "true", specifies output. If "faulse", specifies.
setEnableEmptyParagraph None newVal : boolean blank lines (lines with line breaks only) in Word. newValIf "true", ignored blank lines. If "faulse", outputs empty <p> tags as many as the number of blank lines.
setEnableNonRefId None newVal : boolean While editing in Word, a lot of IDs that are not internally deleted may be created.
Specifies whether these internally unreferenced IDs should be removed in HTML output.
setEnableImgWidth None newVal : boolean Specifies whether to output the width of the image. newValIf "true", specifies to output. If "faulse", specifies not to output.
setEnableHeadingStrong None newVal : boolean Specifies whether to ignore the emphasis specified in the heading style. newValIf "true", specifies to ignore. If "faulse", specifies to output.
setEnableEmbedimage None newVal : boolean Specifies whether to embed the image in the body HTML as a data URL. newValIf "true", specifies to embed the image. If "faulse", specifies images are output to the image folder.
setEnableMathML None newVal : boolean Specifies whether to output to <img> tags in MathML format for formulas edited in the Word Equation Editor. newValIf "true", specifies to output. If "faulse", specifies not to output.
setXmlMathML None newVal : boolean Specifies whether to output to MathML formatted markup for formulas edited in the Word Equation Editor. newValIf "true", specifies to output. If "faulse", specifies not to output.
setOMath None newVal : boolean Specifies whether to output to Word's own Office Math format for formulas edited in the Word Equation Editor. newValIf "true", specifies to output. If "faulse", specifies not to output.
setThroughImage None newVal : boolean Specifies whether to output the image in its original format inserted into Word. newValIf "true", specifies to output. If "faulse", specifies not to output.
setEnablePStyle None newVal : boolean Specifies whether to output the style name of the paragraph by setting it as the value of the class attribute. newValIf "true", specifies to output. If "faulse", specifies not to output.
setEnableCitation None newVal : boolean Specifies whether to outputs the value of tag in the Citation field by setting it as the value of the href attribute of the <a> tag. newValIf "true", specifies to output. If "faulse", specifies not to output.
setTextColor None newVal : boolean Specifies whether to outputs the color specified for the text as <span style="color:color value">. newValIf "true", specifies to output. If "faulse", specifies not to output.
setItalic None newVal : int Specifies the output method when italics are specified for text. newVal Italic output method.
0 : Do not output. (default)
1 : Output as <i>tag.
2 : Output as <span style="font-style:italic">
setUnderline None newVal : int Specifies the output method when underline is specified for text. newVal underline output method.
0 : Do not output. (default)
1 : Output as <u>tag.
2 : Output as <span style="text-decoration-line:underline;">
setLinethrough None newVal : int Specifies the output method when strikethrough is specified for text. newVal strikethrough output method.
0 : Do not output. (default)
1 : Output as <del>tag.
2 : Output as <span style="text-decoration-line: line-through;">
setEncoding None newVal : java.lang.String Specifies the character code (encoding method) of the HTML file. (default : "UTF-8")
setDefstyle None newVal : boolean Specifies whether to output the <style> element (element specifying the default CSS style) in <head>. newValIf "true", specifies not to output. If "faulse", specifies to output.
setSpaceIndent None newVal : boolean Specifies whether to convert the indentation to a a single full-width space when one or more characters of indentation are specified at the beginning of the paragraph. newValIf "true", specifies to convert. If "faulse", specifies not to convert.
setOutputBR None newVal : boolean Specifies whether to output <br> tags at the end of paragraphs instead of enclosing them in <p> tags.
It is invalid when XML grammar is specified in tag output. newValIf "true", specifies to output <br> tags. If "faulse", specifies to output <p> tags.
setFileimages None newVal : boolean Specifies how to name the folder that stores image files. newValIf "true", specifies as "destination_file_name.image". If "faulse", specifies as "image".
setCSS None uri : java.lang.String
media : java.lang.String
Specifies the CSS file to link. uriSpecifies the CSS file path. mediaYou can optionally specify media.
setJS None newVal : java.lang.String Place the script tag in <head> and specify the path (URL) of the JavaScript file in its src attribute. newValSpecified the path of the JavaScript file.
saveSettings None newVal : java.lang.String Specify the path of the option setting file.
setTablestyle None newVal : boolean Specifies whether to output the table-style. newValIf "true", specifies to output. If "faulse", specifies not to output.