Skip to content

Feature Request: Support render method with byte[] for in-memory templates #6

@siagimir

Description

@siagimir

Current Behavior

The current interface for the render method looks like this:

CarboneDocument render(String json, String fileOrTemplateId) throws CarboneException;

This works well for loading templates from disk or the Carbone Cloud.
However, when a template is already loaded into JVM memory (e.g., from a custom storage service), there’s no direct way to use it without writing it to disk or uploading it to the Carbone API.

Proposal

Add a method that accepts the template directly as a byte array:

CarboneDocument render(String json, byte[] templateBytes) throws CarboneException;

This would allow rendering entirely in-memory, improving performance and avoiding I/O or network overhead.

Workarounds Today

Currently, we must either:

  1. Upload the template to the Carbone Cloud (adds network latency), or
  2. Save the template bytes as a temporary file (adds I/O, storage requirement, and file handling overhead).

Benefits

  • Simplifies integration with cloud/custom storage.
  • Enables faster in-memory.
  • Reduces I/O and disk usage in stateless environments (e.g., serverless, containers).

Would this enhancement be possible to consider in a future release?

Thanks for the great SDK and for considering this request!

Miro

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions