Printgraph

HTMLを使ってPDFや画像を生成するためのAPI

Printgraphは、HTMLテンプレートから高品質なPDFや画像を簡単に生成できるAPIサービスです。 請求書、レポート、証明書など、あらゆるドキュメントを動的に作成できます。

2週間無料で試す

📝 テンプレート編集・管理

Webブラウザ上でHTMLテンプレートを直感的に編集・管理。バージョン管理機能により、テンプレートの履歴を追跡し、いつでも以前のバージョンに戻すことができます。

⚡ 高速・スケーラブル

サーバーレスアーキテクチャを採用することで、リクエスト数に応じて自動的にスケールします。急激なトラフィック増加にも柔軟に対応し、常に高速なPDF生成を提供します。

👁️ プレビュー機能

テンプレート編集中にリアルタイムでPDFのプレビューを確認できます。実際の出力を見ながら調整できるため、開発時間を大幅に短縮できます。

🔒 プライバシー保護

Printgraphでは、送信されたデータやPDF情報をサーバー上に保存しません。生成後すぐに削除されるため、機密情報を扱う場合でも安心してご利用いただけます。

💰 従量課金制

月額固定費は不要。PDF生成数に応じた従量課金制のため、小規模から大規模まで柔軟にご利用いただけます。使わない月はコストがかかりません。

🛠️ 専用SDK

JavaScript、Python、PHP、Rubyなど主要な言語に対応したSDKを提供。わずか数行のコードで既存のアプリケーションに統合できます。

簡単に始められる

Node.js (SDK)

import { Printgraph } from '@printgraph/sdk';

const client = new Printgraph({
  apiKey: process.env.PRINTGRAPH_API_KEY,
  baseUrl: 'https://api.printgraph.io'
});

const pdf = await client.generatePdf({
  templateId: 'invoice-template',
  params: {
    customerName: 'John Doe',
    amount: 10000
  },
  format: 'A4'
});

PHP (SDK)

<?php

use Printgraph\PhpSdk\Api\Pdf\Generator\GenerateRequest;
use Printgraph\PhpSdk\Client\ClientFactory;
use Printgraph\PhpSdk\Printgraph;

require 'vendor/autoload.php';

$printgraph = new Printgraph(
    ClientFactory::createHttpClient(getenv('PRINTGRAPH_API_KEY'))
);
$request = new GenerateRequest(
    '<<your template id>>', // テンプレートID
    [
        'customerName' => 'John Doe',
        'amount' => 10000
    ]
);

$response = $printgraph->pdf()->generate($request)->expect(
    new \RuntimeException('Failed to generate PDF')
);

file_put_contents('generated.pdf', $response->getContents());

Python (HTTP)

import requests
import os

response = requests.post(
    'https://api.printgraph.io/pdf/generate',
    headers={
        'Authorization': f'Bearer {os.getenv("PRINTGRAPH_API_KEY")}',
        'Content-Type': 'application/json'
    },
    json={
        'templateId': 'invoice-template',
        'params': {
            'customerName': 'John Doe',
            'amount': 10000
        },
        'format': 'A4'
    }
)

pdf = response.content

Ruby (HTTP)

require 'net/http'
require 'json'

uri = URI('https://api.printgraph.io/pdf/generate')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = "Bearer #{ENV['PRINTGRAPH_API_KEY']}"
req['Content-Type'] = 'application/json'
req.body = {
  templateId: 'invoice-template',
  params: {
    customerName: 'John Doe',
    amount: 10000
  },
  format: 'A4'
}.to_json

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(req)
end

pdf = res.body