DEV Community

Hisa Araki
Hisa Araki

Posted on

ACR is designed as a printer-independent report rendering service, not just a library.

Introduction

I have added an HTTP interface to the report engine ACR (Across Report Renderer).

By making ACR available over HTTP, it can be used as a rendering service independent from the application.

Previously, report systems had to be implemented separately depending on the development environment (Desktop, Web), OS, and runtime environment.
With ACR, you can now generate PDF / PNG / HTML simply by sending a template and data.

What you can do

• Generate reports via HTTP
• Language-independent (HTTP-based)
• Can be called from Node.js / C# / Python / Java
• Output formats: PDF / PNG / HTML (PNG embedded in HTML)
• Test directly from a browser (Web UI included)
• Runs on Windows / Linux / macOS
• Can run as a service (daemon) on all supported OS
Enter fullscreen mode Exit fullscreen mode

Start

./acr_http
Enter fullscreen mode Exit fullscreen mode

You can also specify port and template directory:

./acr_http --port 9000 --templates /opt/acr/templates
Enter fullscreen mode Exit fullscreen mode

Web UI

Open the following in your browser:

http://localhost:8765/
Enter fullscreen mode Exit fullscreen mode

curl(PDF)

curl -X POST http://localhost:8765/render/pdf \
  -H "Content-Type: application/json" \
  -d '{
    "template": "invoice",
    "data": {
      "items": [
        { "name": "Apple", "price": 100 },
        { "name": "Orange", "price": 200 }
      ]
    }
  }' \
  --output out.pdf
Enter fullscreen mode Exit fullscreen mode

curl(PNG)

curl -X POST http://localhost:8765/render/png \
  -H "Content-Type: application/json" \
  -d '{ "template": "invoice", "data": { "items": [] } }' \
  --output out.png
Enter fullscreen mode Exit fullscreen mode

curl (HTML)

curl -X POST http://localhost:8765/render/html \
  -H "Content-Type: application/json" \
  -d '{ "template": "invoice", "data": { "items": [] } }'
Enter fullscreen mode Exit fullscreen mode

Running as a service

Windows

acr_http.exe --install
sc start AcrHttpServer
Enter fullscreen mode Exit fullscreen mode

Linux (systemd)

systemctl enable acr_http
systemctl start  acr_http
Enter fullscreen mode Exit fullscreen mode

macOS

launchctl load ~/Library/LaunchAgents/com.acrossreport.acr_http.plist
Enter fullscreen mode Exit fullscreen mode

Architecture

• Rust-based engine
• Rendering with Skia
• Runs as an HTTP server
• Template and data are separated
Enter fullscreen mode Exit fullscreen mode

Summary

The HTTP version is already released for evaluation.
• Command-line renderer: acr-cli
• Report designer: acr-designer
• RPX converter for ActiveReports: rpx2json

Roadmap

The following features are planned:
• WebAssembly (WASM) support for browser execution
• Receipt printer support (ESC/POS)
• Support for printer command languages (ZPL / SBPL / TPCL)

This will extend ACR beyond server-side usage to embedded devices, edge environments, and browsers.

Download

https://github.com/acrossreport

Top comments (0)