By shifting document layout and formatting concerns from code to templates, the Java application now focuses on data provision and managing the docgen process.
The Docmosis-Java API provides fine-grain control over:
Explore the diagrams on the right to understand key Docmosis-Java concepts and components.
This unique approach allows Docmosis-Java to efficiently perform single transactional requests, or scale to meet large batch processing requirements.
Coding in Java, doesn’t necessarily mean using Docmosis-Java. Java developers, looking for a self-hosted option, should consider Tornado as an alternative. Tornado provides access to the Docmosis engine as a web service and is easy to integrate via a simple REST based API.
// Configuration and initialisation
Configuration config = new Configuration(licenseKey, site, path); SystemManager.initialise(config);
// Create a data provider and add some data
DataProviderBuilder dpb = new DataProviderBuilder();
dpb.add(“message”, “This docgen engine is working great!”)
// Specify template and output files and formats
File templateFile = new File(“myTemplate.docx”);
File outputFile = new File(“result.pdf”);
// Generate the document
DocumentProcessor.renderDoc(templateFile, outputFile, dpb.getDataProvider());
Add Docmosis to your application with 7 lines of code.
Start a free trial to receive a Docmosis-Java license key valid for 30 days.
The trial key can be used to run a single converter (D-100 equivalent) with options to trial higher powered editions or extend the trial on request.
Follow the instructions on our Resources Website to help you get started.
The Docmosis-Java JAR file contains all of the components needed to start and manage the engine.
Firstly, add the JAR file to your Java application. This is called the “Core”.
The Core gives the application complete control over all aspects of the engine (eg: initializaion, template management and rendering) via a Java API.
The JAR file also contains a separate Java executable called a “Converter”.
Docmosis-Java can be configured to start the converters on the same server where the main Java application is running. These are called “Embedded” converters.
Alternatively, the JAR can be used to run the converters on a separate server. These are called “Remote” converters.
A Simple Application
During the trial phase, or for simple applications, it is common for the main Java application and the converters to run on the same server.
Using the trial license key, Docmosis-Java will start one embedded converter.
Adding more converters makes it possible to process multiple render requests in parallel.
The main application and the converters can run on different networked computers.
This enables processing load, and dependencies, to be moved away from the main application server.
Communication between the core and the converters is conducted over the local network using TCP/IP.
This approach is suitable where the number and configuration of all servers is known in advance.
The document generation capacity for a single application can be scaled by introducing more remote converters, spread across multiple servers.
The core maintains an internal queue of pending jobs and ensures efficient use of the available converters.
Scaling and OEM
Docmosis-Java can be embedded and distributed with the Java application.
The main application can scale, by running multiple instances, and each instance makes use of its own embedded converters. This approach is useful given the auto-scaling capabilites of modern cloud platforms.
Alternatively, a Java application can be distributed and run by multiple end-users, when using OEM licensing.