Sferyx JSyndrome HTML Generator and Converter Component
Convert easily Docx, RTF, Plain Text and Images to HTML in your Java applications
Advanced Java Docx, RTF, Plain Text to HTML Generator and Converter component - convert easily Microsoft Word Docx files to HTML, Rich Text Format to HTML and create HTML documents dynamically from various formats and sources
Sferyx HTML Generator Component is an advanced and powerful Java Docx, RTF and Text to HTML Generator and Converter component. It can convert easily Microsoft Word Docx and RTF to HTML in any Java Application - Java Swing, JavaFX, SWT Eclipse and also Oracle Forms and produces perfectly formatted documents embedding all external images and base64 encoded strings. It will include at the beginning and at the end the headers and footers and will insert also the existing page breaks from the original documents. With only a few lines of Java code is possible to generate complex HTML files from almost any Word Docx source or location, any RTF file, plain text documents and also different image types such as JPEG, TIFF, BMP, PNG, GIF - all these images will be converted automatically into base64 encoded images inside the HTML code and saved as HTML documents. The resulting HTML can be written to a local file, java.io.OutputStream or shown automatically inside the browser. The Docx and RTF to HTML Converter Java component supports all UTF-8 languages including support for Greek, Arabic, Cyrillic, Hebrew, Farsi, Chinese, Japanese, Hindi, Tamil and more. The Sferyx HTML Generator and Converter component is ready for use out of the box and does not depend on external packages.
You can create HTML files dynamically by adding the content on-the-fly from different formats and sources.
Trusted Code Signing Security Certificate from Thawte
Version 23.0
Sferyx JSyndrome HTML Generator and Converter Component Edition: HTMLGeneratorDemo.zip
- Pure Java Docx to HTML Generation engine - allows fast and easy HTML creation from various sources and also convert even very complex Docx and RTF documents with single line of code - 100% in house development - it does not depend on external packages.
- Converts and generates quickly and easily HTML files directly from Microsoft Word Docx documents
- Converts and generates quickly and easily HTML files directly from Rich Text Format RTF documents
- Creates self contained HTML files directly from JPEG, TIFF, BMP, GIF, PNG etc - all images will be embedded inside the HTML code as base64 encoded strings.
- Royalty free redistribution with your applications
- Inclusion of all images including the inline Base64 encoded images, inline and linked CSS styles etc.
- Works with any JRE/ JDK 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 9, 10, 11, 12, 13, 14, 15, 16, 17 or higher
- Support for Oracle Forms and full generation of HTML from Docx from Oracle Forms and CLOB
- Fully compatible with Java Swing, JavaFX, SWT Eclipse, Oracle Forms, Java Servlets, JSP
- Compatible with Headless mode for server systems
- Compact size and fast document generation
- Now all hyperlinks inside the Docx and RTF documents are generated as links (annotations) automatically into the resulting HTML file
- Support for disabling the table breaking across multiple pages
- Support for disabling lists breaking across multiple pages
- Support for the CSS page break elements page-break-before:always, page-break-after:always, page-break-inside:never
Example usage
The use of the
HTMLGenerator component is quite simple - with only a few
lines of code is possible to generate and convert practically
any Docx, RTF or Text document to HTML.
Here are some examples of converting the different document types:
Convert Word Docx to HTML from URL to File
This method will convert the Docx to HTML and will save it to given file. The
destinationFile parameter is a
java.io.File object:
HTMLGenerator htmlGenerator=new HTMLGenerator ();
htmlGenerator.generateHTMLFromDocxURL ("http://your_url_here.docx", destinationFile);
or using the file name as String:
HTMLGenerator htmlGenerator=new HTMLGenerator ();
htmlGenerator.generateHTMLFromDocxURL ("http://your_url_here.docx", "c:/htmlgenerator-test1.html");
Convert Word Docx to HTML from URL to OutputStream
It will convert the specified Docx document to HTML using the standard page format string such as "A4", "Letter" etc. and and save it to the specified OutputStream. This method will recognize automatically if the document is Docx file and will convert it accordingly. To use this automatic conversion the URL must end with the corresponding extension like docx.
Convert Rich Text Format RTF to HTML from URL to File
This method will convert the RTF to HTML and will save it to given file. The destinationFile parameter is a
java.io.File object:
HTMLGenerator htmlGenerator=new HTMLGenerator ();
htmlGenerator.generateHTMLFromRTFURL ("http://your_url_here.rtf", destinationFile);
or using the file name as String:
HTMLGenerator htmlGenerator=new HTMLGenerator ();
htmlGenerator.generateHTMLFromRTFURL ("http://your_url_here.rtf", "c:/htmlgenerator-test1.html");
Convert Rich Text Format RTF to HTML from URL to OutputStream
It will convert the specified RTF document to HTML and and save it to the specified OutputStream. To use this automatic conversion the URL must end with the corresponding extension like docx.
Convert automatically Word Docx, RTF, Plain Text or Images to HTML using the method generateHTMLFromURL
This
method will recognize automatically from the file extension if the document is Docx file, RTF file, Text or images and will convert it accordingly. The output can be saved to java.io.File, java.io.OutputStream etc. To
use this automatic conversion the URL must end with the
corresponding extension like docx, rtf, txt etc.
Dynamically Generate HTML from Word Docx, RTF, Text and convert multiple files in Java with the Sferyx HTML Generator
You can generate even very complex HTML documents dynamically in your Java application by simply providing all the formatting in HTML and inserting page breaks when new pages are needed - the HTML Generator will take care automatically for all the pagination of long formatted text spanning through multiple pages and also tables, lists etc. This functionality is perfect for creating various reports and other documents which need to be generated dynamically with rich text formatting. You can insert dynamically also Docx files which will be converted automatically to HTML or Rich Text Format, images, Plain Text etc. - everything will be converted automatically and inserted as HTML in the whole document.
HTMLGenerator htmlGenerator=new HTMLGenerator();
//Open the content buffer to insert the content - HTML, Docx, RTF, Text etc - everything can be merged together.
htmlGenerator.openContentBuffer();
//Append the content to the content buffer - you can insert styles, images and any kind of formatting.
htmlGenerator.appendHTMLContentToContentBuffer("<style>body{font-size:12pt;color:blue;} h1{background-color:yellow;}</style>");
htmlGenerator.appendHTMLContentToContentBuffer("<h1>This is H1 header</h1>Some other text <b>very important <i>stuff</i></b> with page break after");
//Insert page break to create new page - the HTMLGenerator will handle automatically all the pagination for long text if more pages are needed, tables and everything.
htmlGenerator.addPageBreakToContentBuffer();
//Append the content for the new page.
htmlGenerator.appendHTMLContentToContentBuffer("<h2 style=\"background-color:green;border-bottom:1px solid red;color:white\">This is second H2 header</h2>Some other text <span style=\"color:orange\">extremely interesting <u>stuff</u></b></span><br>");
//Append Plain Text Content
htmlGenerator.appendPlainTextContentToContentBuffer("Here we put some plain text\nin new line other text\n\ttab space other stuff here... with page break after");
//Insert another page break...
htmlGenerator.addPageBreakToContentBuffer();
htmlGenerator.appendHTMLContentToContentBuffer("<style>table{border-collapse:collapse;} td{border:1px solid red;}</style>");
//Create table dynamically...
htmlGenerator.appendHTMLContentToContentBuffer("<table style=\"border:1px solid black;\" ><tr><td>row 1 col 1</td><td>row 1 col 2</td></tr><tr><td style=\"background-color:yellow\">row 2 col 1</td><td>row 2 col 2</td></tr></table> with page break after the table");
//Insert another page break...
htmlGenerator.addPageBreakToContentBuffer();
htmlGenerator.appendHTMLContentToContentBuffer("<h1 style=\"border-bottom:1px solid orange;\">Some other text here and the beginning of the Docx file:</h1>");
....
htmlGenerator.addPageBreakToContentBuffer();
....
//Append MS Word Docx file directly to the content buffer and it will be converted to HTML in the same document
htmlGenerator.appendDocxToContentBuffer(new java.net.URL("file:///c:/test/demo.docx"));
...
//Append Rich Text Format RTF file directly to the content buffer and it will be converted to HTML in the same document
htmlGenerator.appendRTFFileToContentBuffer(new java.net.URL("file:///c:/test/Sample06-1.rtf"));
.....
//Close the content buffer and create the HTML document - there is a possibility to write it to File, OutputStream etc.
htmlGenerator.closeBufferAndGenerateHTML("c:/test/dynamic.html");
Command line arguments for the HTMLGenerator.jar file
You can easily execute the HTMLGenerator.jar from the command line and perform document conversions without writing code using the available command line arguments as follows:
java -jar HTMLGenerator.jar absolute_url destination_file
Example:
C:\test>java -jar "C:\test\HTMLGenerator.jar" http://your_url_here
c:/test/test-html.html
Methods available in the sferyx.administration.htmlgenerator.HTMLGenerator class
Method Summary | |
---|---|
void |
addPageBreakToContentBuffer() Adds a HTML page break to the content buffer and all the content appended after that will be on the next page when printed |
void |
appendDocxToContentBuffer (java.io.File file) Appends the whole content of the Docx file from the File to the content buffer. |
void |
appendDocxToContentBuffer (java.net.URL file) Appends the whole content of the Docx file from the given URL to the content buffer. |
void |
appendHTMLContentToContentBuffer (java.lang.String content) Appends new HTML string to existing content buffer. |
void |
appendPlainTextContentToContentBuffer (java.lang.String content) Appends the Plain Text string content to the content buffer. |
void |
appendRTFBase64EncodedStringToContentBuffer (java.lang.String base64EncodedRTFString) Appends RTF content encoded as Base64 string to the content buffer. |
void |
appendRTFFileToContentBuffer (java.io.InputStream is) Appends RTF file from the InputStream to the content buffer. |
void |
appendRTFFileToContentBuffer (java.net.URL file) Appends RTF file from the URL to the content buffer. |
void |
clearContentBuffer() Closes the content buffer and clears the content. |
String |
closeBufferAndGenerateHTML() Generates the HTML content automatically for given content buffer created prevuiously by using openContentBuffer() and appendContentXXX() methods. |
void |
closeBufferAndGenerateHTML (java.io.OutputStream destinationStream) Closes the existing content buffer and generates the resulting content from the HTML Generator - it will be saved in the given OutputStream. |
void |
closeBufferAndGenerateHTML (java.lang.String destinationFile) Generates the HTML content automatically for given content buffer created prevuiously by using openContentBuffer() and appendContentXXX() methods. |
String |
generateHTMLFromContent (java.lang.String content) Generates HTML automatically for given image or HTML content. |
void |
generateHTMLFromContent (java.lang.String content,
java.io.File destinationFile) Generates html automatically for given html content. |
void |
generateHTMLFromContent (java.lang.String content,
java.io.OutputStream destinationStream) Generates HTML automatically for given image or html content. |
void |
generateHTMLFromContent (java.lang.String content,
java.lang.String destinationFile) Generates the HTML automatically for given html content. |
String |
generateHTMLFromDocxURL(java.lang.String sourceURL) Generates HTML automatically for given URL source containing a MS Word Docx file. |
void |
generateHTMLFromDocxURL (java.lang.String sourceURL,
java.io.File destinationFile) Generates HTML automatically for given URL source containing a MS Word Docx file. |
void |
generateHTMLFromDocxURL (java.lang.String sourceURL,
java.lang.String destinationFile) Generates HTML automatically for given URL source containing a MS Word Docx file. |
String |
generateHTMLFromDocxURL (java.net.URL sourceURL) Generates HTML automatically for given URL source containing a MS Word Docx file. |
void |
generateHTMLFromDocxURL (java.net.URL sourceURL,
java.io.File destinationFile) Generates HTML automatically for given URL source containing a MS Word Docx file. |
void |
generateHTMLFromDocxURL (java.net.URL sourceURL,
java.io.OutputStream fos) Generates HTML automatically for given URL source containing a MS Word Docx file. |
String |
generateHTMLFromPlainTextContent (java.lang.String content) Generates HTML automatically for given Plain text content. |
void |
generateHTMLFromPlainTextContent (java.lang.String content,
java.io.File destinationFile) Generates HTML automatically for given Plain text content. |
void |
generateHTMLFromPlainTextContent (java.lang.String content,
java.io.OutputStream destinationStream) Generates HTML automatically for given Plain text content. |
void |
generateHTMLFromPlainTextContent (java.lang.String content,
java.lang.String destinationFile) Generates HTML automatically for given Plain text content. |
void |
generateHTMLFromRTFContentBase64String (java.lang.String rtfString,
java.io.OutputStream outputStream) Generates HTML automatically for given URL source containing a base64 encoded Rich Text Format RTF string. |
String |
generateHTMLFromRTFInputStream (java.io.InputStream rtfStream) Generates HTML automatically for given InputStream containing a Rich Text Format RTF file. |
void |
generateHTMLFromRTFInputStream (java.io.InputStream rtfStream,
java.io.OutputStream outputStream) Generates HTML automatically for given InputStream containing a Rich Text Format RTF file. |
String |
generateHTMLFromRTFURL (java.lang.String sourceURL) Generates HTML automatically for given URL source containing a Rich Text Format RTF file. |
void |
generateHTMLFromRTFURL (java.lang.String sourceURL,
java.io.File destinationFile) Generates HTML automatically for given URL source containing a Rich Text Format RTF file. |
void |
generateHTMLFromRTFURL (java.lang.String sourceURL,
java.lang.String destinationFile) Generates HTML automatically for given URL source containing a Rich Text Format RTF file. |
String |
generateHTMLFromRTFURL (java.net.URL sourceURL) Generates HTML automatically for given URL source containing a Rich Text Format RTF file. |
void |
generateHTMLFromRTFURL (java.net.URL sourceURL,
java.io.File destinationFile) Generates HTML automatically for given URL source containing a Rich Text Format RTF file. |
void |
generateHTMLFromRTFURL (java.net.URL sourceURL,
java.io.OutputStream fos) Generates HTML automatically for given URL source containing a Rich Text Format RTF file. |
void |
generateHTMLFromURL (java.lang.String sourceURL) Generates HTML automatically for given URL source. |
void |
generateHTMLFromURL (java.lang.String sourceURL,
java.io.File destinationFile) Generates HTML automatically for given URL source and saves the result to destinationFile as string. |
void |
generateHTMLFromURL (java.lang.String sourceURL,
java.io.OutputStream destinationStream) Generates HTML automatically for given URL source and saves the result to the given OutputStream as a string. |
void |
generateHTMLFromURL (java.lang.String sourceURL,
java.lang.String destinationFile) Generates HTML automatically for given URL source and saves the result to destinationFile as a string. |
String |
generateHTMLFromURL (java.net.URL sourceURL) Generates HTML automatically for given URL source and saves the result will be returned as a String. |
void |
generateHTMLFromURL (java.net.URL sourceURL,
java.io.OutputStream destinationStream) Generates HTML automatically for given URL source and saves the result to destinationStream as string. |
boolean |
getXMLMode () Returns the XML mode for the renderer. |
void |
openContentBuffer () Opens the new content buffer for inserting content to be used for dynamic HTML generation. |
void |
setXMLMode (boolean mode) Sets the XML mode for the renderer - this will define how custom XML tags will be rendered. |
Customers
Sferyx customer base counts more than 1000 corporate customers and institutions from over 40 countries and different industrial sectors as follows: Media and publishing companies, Internet Service Providers, Research Labs, Fortune 500 companies, Universities, Colleges and Schools, Software Developers, Content Management Systems developers, Web design agencies.
More than 1000 corporate customers, among them:
|
Home
| Users Manual | License | Demo
& Download
Copyright © 2001-2024 Sferyx
Srl. All rights reserved. Sferyx and the Sferyx logo are registered trademarks
of Sferyx Srl. http://www.sferyx.com