Standalone HTML Generation

Generate HTML programmatically for emails, newsletters, and reports—no web server required.

More Than a Web Framework

Oorian's HTML element classes can be used independently to generate HTML strings for any purpose.

Email Generation

Build HTML emails with proper structure, inline styles, and responsive layouts using type-safe Java code.

Newsletters

Create complex newsletter templates with headers, columns, and formatted content programmatically.

Reports & Documents

Generate HTML for PDF conversion or document export with consistent, maintainable code.

Type-Safe HTML

No string concatenation or template typos. Every element and attribute is validated at compile time.

Reusable Components

Build email components once, reuse them across your application with OOP principles.

No Server Required

Use Oorian as a simple library dependency. Generate HTML in batch jobs, CLI tools, or any Java application.

Example: Generating an Email

Use Oorian's element classes to build HTML emails with proper structure and inline styles.

java
public class EmailGenerator
{
    public String generateWelcomeEmail(String userName, String activationLink)
    {
        // Create the email structure
        Html html = new Html();

        Head head = new Head();
        head.addElement(new Meta().setCharset("UTF-8"));
        head.addElement(new Title("Welcome to Our Service"));
        html.addElement(head);

        Body body = new Body();
        body.addStyleAttribute("font-family", "Arial, sans-serif");
        body.addStyleAttribute("line-height", "1.6");
        body.addStyleAttribute("color", "#333333");

        // Container table for email clients
        Table container = new Table();
        container.setWidth("100%");
        container.addAttribute("cellpadding", "0");
        container.addAttribute("cellspacing", "0");

        Tr row = new Tr();
        Td cell = new Td();
        cell.addStyleAttribute("padding", "40px");
        cell.addStyleAttribute("text-align", "center");

        // Content wrapper
        Div content = new Div();
        content.addStyleAttribute("max-width", "600px");
        content.addStyleAttribute("margin", "0 auto");
        content.addStyleAttribute("background-color", "#ffffff");
        content.addStyleAttribute("padding", "40px");
        content.addStyleAttribute("border-radius", "8px");

        // Header
        H1 header = new H1();
        header.setText("Welcome, " + userName + "!");
        header.addStyleAttribute("color", "#2563eb");
        content.addElement(header);

        // Message
        P message = new P();
        message.setText("Thank you for signing up. Click the button below to activate your account.");
        content.addElement(message);

        // CTA Button (use A class for hyperlinks)
        A button = new A(activationLink);
        button.setText("Activate Account");
        button.addStyleAttribute("display", "inline-block");
        button.addStyleAttribute("background-color", "#2563eb");
        button.addStyleAttribute("color", "#ffffff");
        button.addStyleAttribute("padding", "14px 28px");
        button.addStyleAttribute("text-decoration", "none");
        button.addStyleAttribute("border-radius", "6px");
        button.addStyleAttribute("margin-top", "20px");
        content.addElement(button);

        cell.addElement(content);
        row.addElement(cell);
        container.addElement(row);
        body.addElement(container);
        html.addElement(body);

        // Generate the HTML string
        return html.toString();
    }
}

// Usage
EmailGenerator generator = new EmailGenerator();
String htmlEmail = generator.generateWelcomeEmail("John", "https://example.com/activate/abc123");
emailService.send("john@example.com", "Welcome!", htmlEmail);

Common Use Cases

Transactional Emails

Welcome emails, password resets, order confirmations, shipping notifications—generate them all with consistent branding and proper HTML structure.

Marketing Campaigns

Build newsletter templates with dynamic content insertion. Reuse components across campaigns while maintaining brand consistency.

Automated Reports

Generate HTML reports from data for email delivery or PDF conversion. Tables, charts, and formatted data—all type-safe.

Invoices & Receipts

Create professional invoices and receipts with proper formatting, ready for email or print.

Notification Digests

Build digest emails that aggregate multiple notifications into a single, well-formatted message.

CLI & Batch Jobs

Generate HTML in scheduled jobs, command-line tools, or data processing pipelines—no web container needed.

Why Use Oorian for HTML Generation?

No Template Syntax to Learn

Use the same Java skills you already have. No Freemarker, Thymeleaf, or other templating languages required.

Compile-Time Validation

Typos in element names or attributes are caught by the compiler, not discovered when emails look broken in production.

Full IDE Support

Autocomplete, refactoring, and go-to-definition work perfectly. Your IDE knows every HTML element and attribute.

Reusable Components

Build email header, footer, and button components once. Reuse them with inheritance and composition.

Easy Testing

Unit test your HTML generation logic with standard Java testing tools. Assert on element structure and content.

Minimal Dependencies

Just add the Oorian library to your project. No web server, no servlet container, no complex configuration.