- About Cloud-based RTF to HTML Conversion
- Features
- Quickstart
- Installation
- Usage
- Configuration of the RTF to HTML Conversion
- Deployment of the Google Cloud Function
- Limitations
The Java class RtfToHtml implements a Google Cloud Function (HttpFunction) that performs a RTF to HTML conversion using the ScroogeXHTML RTF Converter library.
The function reads the RTF file from the HTTP POST payload, converts it, and responds with the HTML or an error message.
- Complete Source Code and Maven project.
- Deployment script included.
- Demo HTML page included.
- JPG and PNG embedded images (up to 128 KB each)
- Serverless document conversion.
To lauch the local test server enter this Maven command:
mvn function:run
Output:
...
[INFO] jetty-9.4.51.v20230217; built: 2023-02-17T08:19:37.309Z; git: b45c405e4544384de066f814ed42ae3dceacdd49; jvm 21.0.7+6-LTS
[INFO] Started o.e.j.s.ServletContextHandler@3caa4d85{/,null,AVAILABLE}
[INFO] Started ServerConnector@c0013b8{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
[INFO] Started @17722ms
Juli 27, 2025 11:46:53 AM com.google.cloud.functions.invoker.runner.Invoker logServerInfo
INFORMATION: Serving function...
Juli 27, 2025 11:46:53 AM com.google.cloud.functions.invoker.runner.Invoker logServerInfo
INFORMATION: Function: demo.RtfToHtml
Juli 27, 2025 11:46:53 AM com.google.cloud.functions.invoker.runner.Invoker logServerInfo
INFORMATION: URL: http://localhost:8080/
Now you can open the demo.html in your browser and use it to upload an RTF to the local test server.
Note: in case ScroogeXHTML is not installed, you still may use the demo. Just replace the conversion by a hard-coded result.
The following tools are required:
- Google Cloud CLI
- JDK 21
- Maven
- ScroogeXHTML 11.x
- in case ScroogeXHTML is not installed, you still may use the demo. Just replace the conversion by a hard-coded result.
The cloud function is used in the demo currently located at https://www.scroogexhtml.com/index.html
The converter uses a fixed configuration. See the convertRtfToHtml
method in src/main/java/demo/RtfToHtml.java
.
To deploy the Google Cloud function, build the project using
mvn clean package
and then lauch the deploy script file.
- the maximum allowed RTF size is 1024 KB.
- only HTTP requests from https://www.scroogexhtml.com are accepted.
- RTF to HTML conversion
- Google Cloud Function
- Java RTF Converter
- ScroogeXHTML
- Serverless document conversion
- Cloud-based RTF to HTML