Java Mail Merge

Are you developing software that needs to generate documents or reports?

With Docmosis you can quickly and easily add Mail Merge document generation to any Java application.

Docmosis can output in multiple formats: PDF, ODT, Doc, DocX, HTML and RTF.

java mail merge

Java Mail Merge style TEMPLATES

Docmosis templates allow you to visually layout and format a document.

Docmosis templates are just regular documents, created using Microsoft Word or LibreOffice, with added placeholders for any dynamic content much like Mail Merge.

The Java Mail Merge process is simple:

  1. Your Java application passes data to Docmosis.
  2. Docmosis merges the data with your template, to produce the finished document.
  3. Docmosis delivers the document to the specified destinations.

The power of Docmosis comes from the combination of:

  • our simple plain-text templating placeholders (eg: <<name>>), plus
  • your templates inherit the powerful features of the editors used to create them.

Docmosis allows you to:

  • Develop and maintain documents faster than an “all code” solution.
  • Layout your documents visually using editors you already know.
  • Output in two or more formats – without writing any extra code.
  • Easily collaborate on document design with Business Teams and End Users

Jave Mail Merge – Code Samples

// Mail Merge from  myTemplate.doc  to  result.pdf
File templateFile = new File(“myTemplate.doc”);
File outputFile = new File(“result.pdf”);
DocumentProcessor.renderDoc(myTemplateFile, outputFile, buildData());

Get started quickly:

  1. Download and add the docmosis.jar to your application.
  2. Follow the videos for setting up your environment.
  3. Start with these java code samples

Creating Templates is EASY

Templates can be created using Microsoft Word or LibreOffice with NO plug-ins.

There is no need to learn a new report-writing-tool with limited features.

Here is a few of the many things you can do with the Docmosis templating system:

  • Insert dynamic text or images into the: body; headers and footers.
  • Add/remove any content based on conditional data.
  • Modify formatting during document generation based on the data.
  • Expand table rows, numbered lists and bullet lists to match the data.
  • Dynamically insert images and watermarking.
  • Hyperlink insertion.
  • Insert HTML content.

Great features in one MAIL-MERGE ENGINE

Docmosis has taken the best of mail-merging principles to the application space:

  • Normal word processor documents – no plug-ins or customizations
  • Word and LibreOffice input formats supported include: DOCDOCX and ODT.
  • Output options include: PDFODTDOCDOCXRTF and HTML.
  • Some of the most complex requirements are simple to do, like: don’t break table-rows, keep-together, repeat table heading, page numbering etc.
  • Scalable from simple use to continuous multi-threaded, distributed performance.

How good is it?

Docmosis has been engineered for performance  from the outset with a focus on low-memory footprint, stream-oriented and pre-optimized rendering and built-in load distribution facilities.

The output is typically very impressive, particularly PDF results which are high quality (zoom well) searchable and can even be password protected or created in archive format PDF/A-1.

Docmosis is used in: Finance, Legal, Logistics, HR, Health, Education and Technology applications, trusted by some very busy customers.

Some of our customers have also been kind enough to share some sample documents shown in our Document Gallery.


We give you full access to our Support Team during your evaluation.

If you aren’t sure if Docmosis suits your particular application then just contact support and tell us what you are trying to do.

We have many years of experience with creating documents in Java using mail merge techniques.