Official SDKs
The official libraries in JavaScript, PHP, Python, Java, C# and Ruby to generate PDFs, manage webhooks and verify their signature in a few lines.
Six official libraries make the calls for you. They are MIT licensed, have no dependencies and all offer the same functions.
| Language | Installation | Minimum version |
|---|---|---|
| JavaScript / TypeScript | npm install @mizanpage/sdk |
Node 18 |
| PHP | composer require mizanpage/mizanpage-php |
PHP 8.1, cURL |
| Python | pip install mizanpage |
Python 3.9 |
| Java | com.mizanpage:mizanpage-java (Maven, Gradle) |
Java 11 |
| C# / .NET | dotnet add package Mizanpage |
.NET 8 |
| Ruby | gem install mizanpage |
Ruby 3.0 |
Use them on the server side: an API key never goes into a browser.
JavaScript
import { Mizanpage } from '@mizanpage/sdk';
import { writeFile } from 'node:fs/promises';
const mizanpage = new Mizanpage({ apiKey: process.env.MIZANPAGE_KEY });
const { pdf } = await mizanpage.render(
{ template: 'facture', data: { values: { 'client.nom': 'Brasserie Orlanne SRL' } } },
{ idempotencyKey: 'F-2026-0148' },
);
await writeFile('facture.pdf', pdf);
PHP
$mizanpage = new Mizanpage\Client(getenv('MIZANPAGE_KEY'));
$mizanpage->render(
['template' => 'facture', 'data' => ['values' => ['client.nom' => 'Brasserie Orlanne SRL']]],
'F-2026-0148',
)->save('facture.pdf');
Python
from mizanpage import Mizanpage
mizanpage = Mizanpage(os.environ["MIZANPAGE_KEY"])
mizanpage.render(
{"template": "facture", "data": {"values": {"client.nom": "Brasserie Orlanne SRL"}}},
idempotency_key="F-2026-0148",
).save("facture.pdf")
Java
Mizanpage mizanpage = Mizanpage.builder(System.getenv("MIZANPAGE_KEY")).build();
mizanpage.render(
Map.of("template", "facture", "data", Map.of("values", Map.of("client.nom", "Brasserie Orlanne SRL"))),
"F-2026-0148"
).save(Path.of("facture.pdf"));
C# / .NET
var mizanpage = new MizanpageClient(Environment.GetEnvironmentVariable("MIZANPAGE_KEY")!);
var result = await mizanpage.RenderAsync(
new { template = "facture", data = new { values = new Dictionary<string, string> { ["client.nom"] = "Brasserie Orlanne SRL" } } },
idempotencyKey: "F-2026-0148");
await result.SaveAsync("facture.pdf");
Ruby
mizanpage = Mizanpage::Client.new(ENV.fetch("MIZANPAGE_KEY"))
mizanpage.render(
{ template: "facture", data: { values: { "client.nom" => "Brasserie Orlanne SRL" } } },
idempotency_key: "F-2026-0148"
).save("facture.pdf")
What the SDKs cover
- generate a PDF, directly or with asynchronous rendering: ask, wait and download in one call;
- list templates, read the fields of a template, read or send catalogs;
- manage webhooks;
- the PDF tools without a template: HTML to PDF, merge and split;
- verify the signature of a received webhook (
verifyWebhook,Webhook::verify,verify_webhook,Webhook.verify,Webhook.Verify,Mizanpage.verify_webhook,VerifyWebhook); - act for a client organisation with an installation key (
organisationoption).
Errors
An API error becomes an exception with the HTTP status, the stable code (not_published, missing_fields…) and the readable message. See Errors and limits.