2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Rust製帳票エンジンARCが、HTTP対応しました(PDF / PNG / HTML出力)

2
Last updated at Posted at 2026-04-12

はじめに

帳票エンジン ACR (Across Report Renderer) に HTTP インターフェースを追加しました。
このACRをHTTP化することで、システムから独立したレンダリングサービスとして利用できます。

今までの帳票システムを構築する際には、開発環境(Desktop、Web)、OSや運営環境によって個別に構築していたものがACRによって、テンプレートとデータを送るだけで、PDF / PNG / HTML を生成できるようになりました。

できること

•	HTTP経由で帳票を生成
•	HTTP → 言語非依存
•	Node.js / C# / Python / Java すべて呼び出しできます。
•	PDF / PNG / HTML出力(PNGをhtmlに組み込み)
•	ブラウザから直接テスト可能(Web UI付き)
•	Windows / Linux / macOS で動作可能
•	Windows / Linux / macOS サービス(デーモン)として常駐可能

起動

./acr_http

ポート指定やテンプレートディレクトリも変更可能

./acr_http --port 9000 --templates /opt/acr/templates

Web UI

ブラウザで以下を開きます。

http://localhost:8765/
•	TEMPLATE NAME にテンプレート名
•	DATA JSON にデータを入力
•	Render ボタンで出力

image.png

HTTP API

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

curl(PNG出力)

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

curl (HTML出力 )

htmlにPNGを組み込み出力

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

サービス化

Windows

acr_http.exe --install
sc start AcrHttpServer

Linux (systemd)

systemctl enable acr_http
systemctl start  acr_http

macOS

launchctl load ~/Library/LaunchAgents/com.acrossreport.acr_http.plist

構成

•	Rust製エンジン
•	Skiaによる描画
•	HTTPサーバとして常駐
•	テンプレートとデータを分離

まとめ

すでにhttp版の導入検証用としてリリースしています。
・コマンドライン版(acr-cli)
・帳票定義ファイル作成用デザイナ(acr-designer)
・Active Reports用RPXファイル変換ツール(rpx2json)

今後の対応予定

今後は以下の対応を予定しています。
• WebAssembly(WASM)対応によるブラウザ実行
• ESC/POS などのレシートプリンタ対応
• 各種プリンタコマンドへの対応(ZPL / SBPL / TPCL)

これにより、サーバ用途だけでなく、
組み込み・現場機器・ブラウザ環境まで利用範囲を拡張していきます。

ダウンロード

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?