API documentation
Send HTML, get a PDF back. One request, no SDK. Works for English, Turkish, Spanish, French, German, Russian, Arabic, Hebrew, Chinese, Japanese, Korean and Hindi.
API dokümantasyonu
HTML gönderin, PDF alın. Tek istek, kurulacak bir şey yok. İngilizce, Türkçe, İspanyolca, Fransızca, Almanca, Rusça, Arapça, İbranice, Çince, Japonca, Korece ve Hintçe ile çalışır.
Hızlı başlangıç Dönüştürme Hatalar Kullanım Diller Bilmekte fayda var
Quick start
1. Create a free account and copy your API key from the dashboard. The Free plan includes 50 PDFs a month.
2. Send your HTML to POST https://getprintoza.com/v1/convert with your key in the x-api-key header. The answer is the PDF file itself.
Hızlı başlangıç
1. Ücretsiz hesap açın ve panelden API anahtarınızı kopyalayın. Ücretsiz planda ayda 50 PDF hakkı var.
2. HTML’inizi POST https://getprintoza.com/v1/convert adresine, anahtarınızı x-api-key başlığında göndererek yollayın. Yanıt, PDF dosyasının kendisidir.
curl -X POST https://getprintoza.com/v1/convert \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"html": "<h1>Hello</h1><p>My first PDF.</p>", "format": "A4"}' \
--output document.pdfconst fs = require("fs");
async function makePdf() {
const res = await fetch("https://getprintoza.com/v1/convert", {
method: "POST",
headers: {
"x-api-key": process.env.GETPRINTOZA_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({ html: "<h1>Hello</h1><p>My first PDF.</p>", format: "A4" }),
});
if (!res.ok) throw new Error((await res.json()).error);
fs.writeFileSync("document.pdf", Buffer.from(await res.arrayBuffer()));
}
makePdf();import os
import requests
res = requests.post(
"https://getprintoza.com/v1/convert",
headers={"x-api-key": os.environ["GETPRINTOZA_KEY"]},
json={"html": "<h1>Hello</h1><p>My first PDF.</p>", "format": "A4"},
timeout=60,
)
if res.ok:
with open("document.pdf", "wb") as f:
f.write(res.content)
else:
print(res.json())Keep your key on your server. Never put it in a web page or mobile app that other people can open.
Anahtarınızı kendi sunucunuzda tutun. Başkalarının açabileceği bir web sayfasına veya mobil uygulamaya koymayın.
POST /v1/convert
Turns HTML into a PDF. Send JSON with the header x-api-key and Content-Type: application/json.
| Field | Type | Description |
|---|---|---|
html | string Required | The full HTML of your document. Up to 8,000,000 characters. |
language | string Optional | Language of the content: en tr es fr de ru ar he zh ja ko hi. It sets the lang of your page so the right letter shapes are used (this matters for Chinese and Japanese). Ignored if your <html> tag already has a lang. If you leave it out, we detect Chinese, Japanese, Korean, Arabic and Hebrew automatically when most of the letters in your document are in that script; a single foreign name in an English invoice changes nothing. |
format | string Optional | A3, A4, A5, Letter, Legal or Tabloid. If you leave it out, the page size in your own HTML is used, otherwise A4. |
landscape | true / false Optional | true for a landscape page. Any value that is not true or false is ignored without an error. If you send format or landscape, they win over any @page rule in your HTML. |
margin | number Optional | Page margin in millimetres, the same on all four sides, from 0 to 50. For example 10 gives a 10 mm margin. If you leave it out, 15 mm is used. |
footer | true / false Optional | true prints a page number at the bottom of every page, such as “Page 2 of 5”. The text follows the language of your document: the language field, otherwise the lang in your <html> tag, otherwise English. Arabic and Hebrew read right to left, and Chinese, Japanese, Korean and Hindi use their own fonts. Numbers are always written with 0–9. A bottom margin of at least 10 mm is kept so the text is not cut off. |
footerText | string Optional | A short line of plain text (up to 80 characters, one line) printed before the page number, such as your company name: “Acme Ltd. · Page 2 of 5”. It turns the page number on by itself, unless you send footer: false. The text is shown exactly as you write it; HTML in it is not run. |
A successful answer is status 200 with the PDF as the body. The header X-Quota-Remaining tells you how many PDFs are left in this period. The answer also carries Content-Disposition: attachment; filename="document.pdf", so a browser saves it as a file.
Empty-box warning. If your HTML contains characters that none of our fonts can draw, the PDF is still made, but those characters would show up as empty boxes. In that case the answer also has the header X-Getprintoza-Warnings, for example unsupported_characters; count=2; U+2603,U+1F9FF (the count, then up to 20 character codes). No header means nothing was found. It is a best-effort check and it is skipped when your HTML loads its own web fonts.
Automatic credit refund. When the warning header is present, the PDF does not count against your monthly quota: we give the credit back and add the header X-Getprintoza-Refunded: true, and X-Quota-Remaining already includes it. This applies to up to 10 PDFs per account each month; after that the PDF is still made and counted as usual. There is no refund when the check is skipped (your HTML loads its own web fonts).
POST /v1/convert
HTML’i PDF’e çevirir. x-api-key ve Content-Type: application/json başlıklarıyla JSON gönderin.
| Alan | Tür | Açıklama |
|---|---|---|
html | string Zorunlu | Belgenizin HTML’inin tamamı. En fazla 8.000.000 karakter. |
language | string İsteğe bağlı | İçeriğin dili: en tr es fr de ru ar he zh ja ko hi. Sayfanızın lang değerini ayarlar, böylece doğru harf biçimleri kullanılır (Çince ve Japoncada önemlidir). <html> etiketinizde zaten lang varsa dikkate alınmaz. Vermezseniz, belgedeki harflerin çoğu Çince, Japonca, Korece, Arapça ya da İbranice ise dili kendimiz algılarız; İngilizce bir faturadaki tek bir yabancı isim hiçbir şeyi değiştirmez. |
format | string İsteğe bağlı | A3, A4, A5, Letter, Legal veya Tabloid. Vermezseniz HTML’inizdeki sayfa boyutu, o da yoksa A4 kullanılır. |
landscape | true / false İsteğe bağlı | Yatay sayfa için true. true ya da false dışındaki bir değer hata vermeden yok sayılır. format veya landscape gönderirseniz HTML’inizdeki @page kuralından önce gelir. |
margin | number İsteğe bağlı | Sayfa kenar boşluğu, milimetre cinsinden; dört kenarda da aynıdır, 0 ile 50 arasında. Örneğin 10 yazarsanız 10 mm boşluk kalır. Vermezseniz 15 mm kullanılır. |
footer | true / false İsteğe bağlı | true yazarsanız her sayfanın altına “Sayfa 2 / 5” gibi bir sayfa numarası basılır. Metin belgenizin diline uyar: önce language alanı, yoksa <html> etiketinizdeki lang, o da yoksa İngilizce. Arapça ve İbranice sağdan sola yazılır; Çince, Japonca, Korece ve Hintçe kendi fontlarını kullanır. Rakamlar her zaman 0–9 ile yazılır. Yazı kesilmesin diye alt boşluk en az 10 mm tutulur. |
footerText | string İsteğe bağlı | Sayfa numarasının önüne yazılan kısa düz metin (en fazla 80 karakter, tek satır); örneğin şirket adınız: “Acme Ltd. · Sayfa 2 / 5”. Sayfa numarasını kendiliğinden açar; footer: false yazarsanız açmaz. Metin yazdığınız gibi gösterilir, içindeki HTML çalışmaz. |
Başarılı yanıt 200 durum koduyla gelir ve gövdesi PDF’tir. X-Quota-Remaining başlığı bu dönemde kaç PDF hakkınız kaldığını söyler. Yanıtta ayrıca Content-Disposition: attachment; filename="document.pdf" başlığı gelir, tarayıcı bunu dosya olarak kaydeder.
Boş kutu uyarısı. HTML’inizde hiçbir fontumuzun çizemediği karakterler varsa PDF yine hazırlanır, ama o karakterler boş kutu olarak görünür. Bu durumda yanıtta ayrıca X-Getprintoza-Warnings başlığı olur; örneğin unsupported_characters; count=2; U+2603,U+1F9FF (önce sayı, sonra en çok 20 karakter kodu). Başlık yoksa sorun bulunmadı demektir. Bu en iyi çaba kontrolüdür; HTML’iniz kendi web fontunu yüklüyorsa atlanır.
Otomatik kredi iadesi. Uyarı başlığı varsa o PDF aylık hakkınızdan düşmez: krediyi geri veririz, yanıta X-Getprintoza-Refunded: true başlığını ekleriz ve X-Quota-Remaining bunu zaten içerir. Bu, hesap başına her ay en fazla 10 PDF için geçerlidir; sonrasında PDF yine hazırlanır ve her zamanki gibi sayılır. Kontrol atlandığında (HTML’iniz kendi web fontunu yüklüyorsa) iade yapılmaz.
HTTP/1.1 200 OK
Content-Type: application/pdf
X-Quota-Remaining: 987Arabic example. Arabic and Hebrew documents are set to right-to-left for you, and the right fonts are already installed. If you prefer to control it yourself, add dir="ltr" or dir="rtl" to your <html> tag and we will not change it.
Arapça örneği. Arapça ve İbranice belgeler sizin için kendiliğinden sağdan sola ayarlanır, gerekli yazı tipleri de sunucuda hazırdır. Kendiniz belirlemek isterseniz <html> etiketinize dir="ltr" veya dir="rtl" yazın, biz dokunmayız.
curl -X POST https://getprintoza.com/v1/convert \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"html": "<h1>مرحبا</h1><p>فاتورة مبيعات</p>", "language": "ar"}' \
--output arabic.pdfErrors
When something goes wrong you get a JSON body like the one below, with the status codes in this table.
Hatalar
Bir sorun olduğunda aşağıdaki gibi bir JSON gövdesi ve bu tablodaki durum kodlarından biri gelir.
HTTP/1.1 429 Too Many Requests
Content-Type: application/json
{ "error": "quota_exceeded", "plan": "free", "limit": 50 }| Status | Error | What it means |
|---|---|---|
400 | html_field_required | The html field is missing or is not text. |
400 | language_not_enabled | The language code is not supported. The response lists the valid codes. |
400 | invalid_format | format is not one of the allowed sizes. The response lists them. |
400 | invalid_margin | margin is not a number between 0 and 50. The response shows the allowed range. |
400 | invalid_footer | footer is not true or false. |
400 | invalid_footer_text | footerText is not plain text of 1 to 80 characters on one line. The response shows the maximum. |
400 | invalid_json | The request body is not valid JSON. |
401 | invalid_or_missing_api_key | The x-api-key header is missing or wrong. |
403 | email_not_verified | Your email address is not confirmed yet. Open the link we sent you (or resend it from the dashboard), then try again. The PDF is not counted. |
413 | html_too_large | The HTML is longer than 8,000,000 characters. |
413 | payload_too_large | The whole request is larger than 10 MB. |
429 | quota_exceeded | You used all PDFs in your plan for this period. The count starts again one month after your period began (your sign-up or subscription date), not on the 1st of the month. Upgrade in the dashboard or wait for the reset. |
429 | too_many_requests | Too many requests in a minute. Wait for the number of seconds in the Retry-After header, then try again. The PDF is not counted. |
503 | server_busy | Too many requests at once. We build only a few PDFs at the same time and keep up to 20 more waiting. When that line is full you get this error. Wait a few seconds and try again. The PDF is not counted, so it is safe to retry. |
500 | render_failed | We could not build the PDF from this HTML. For example, the page took longer than 60 seconds to load (a slow image or font link). The PDF is not counted, so it is safe to retry. |
| Durum | Hata | Ne demek |
|---|---|---|
400 | html_field_required | html alanı yok ya da metin değil. |
400 | language_not_enabled | language kodu desteklenmiyor. Yanıtta geçerli kodlar listelenir. |
400 | invalid_format | format izin verilen boyutlardan biri değil. Yanıtta liste gelir. |
400 | invalid_margin | margin 0 ile 50 arasında bir sayı değil. Yanıtta izin verilen aralık gelir. |
400 | invalid_footer | footer true ya da false değil. |
400 | invalid_footer_text | footerText tek satırlık, 1 ile 80 karakter arası düz metin değil. Yanıtta üst sınır gelir. |
400 | invalid_json | İstek gövdesi geçerli bir JSON değil. |
401 | invalid_or_missing_api_key | x-api-key başlığı yok ya da yanlış. |
403 | email_not_verified | E-posta adresiniz henüz doğrulanmadı. Size gönderdiğimiz bağlantıyı açın (ya da panelden yeniden gönderin), sonra tekrar deneyin. PDF hakkınızdan düşmez. |
413 | html_too_large | HTML 8.000.000 karakterden uzun. |
413 | payload_too_large | İsteğin tamamı 10 MB’tan büyük. |
429 | quota_exceeded | Bu dönem plandaki tüm PDF haklarını kullandınız. Sayaç, dönemin başladığı günden (kayıt ya da abonelik tarihiniz) bir ay sonra sıfırlanır; ayın 1’inde değil. Panelden planı yükseltin ya da sıfırlanmayı bekleyin. |
429 | too_many_requests | Bir dakikada çok fazla istek gönderdiniz. Retry-After başlığındaki saniye kadar bekleyip tekrar deneyin. PDF hakkınızdan düşmez. |
503 | server_busy | Aynı anda çok fazla istek var. Aynı anda sınırlı sayıda PDF üretiyoruz, 20 isteği de sırada bekletiyoruz; sıra dolunca bu hatayı alırsınız. Birkaç saniye bekleyip tekrar deneyin. PDF hakkınızdan düşmez, güvenle tekrar deneyebilirsiniz. |
500 | render_failed | Bu HTML’den PDF üretemedik. Örneğin sayfa 60 saniyeden uzun sürede yüklendi (yavaş bir resim ya da font bağlantısı). PDF hakkınızdan düşmez, güvenle tekrar deneyebilirsiniz. |
GET /v1/usage
Shows your plan and how many PDFs you have used this month. Checking usage does not use up a PDF.
GET /v1/usage
Planınızı ve bu ay kaç PDF kullandığınızı gösterir. Kullanımı sorgulamak PDF hakkınızdan düşmez.
curl https://getprintoza.com/v1/usage -H "x-api-key: YOUR_API_KEY"
{ "plan": "starter", "usedThisMonth": 13, "monthlyLimit": 1000, "remaining": 987 }GET /v1/languages
Lists the language codes you can use in the language field. No API key needed.
GET /v1/languages
language alanında kullanabileceğiniz dil kodlarını listeler. API anahtarı gerekmez.
curl https://getprintoza.com/v1/languages
{ "enabled": [ { "code": "en", "name": "English", ... }, { "code": "ar", "name": "العربية", ... } ] }Good to know
- Each PDF that is built counts as one against your monthly plan. If we fail to build it, it is not counted.
- Speed limit: up to 10 requests a minute on the Free plan and 60 a minute on paid plans. Going over returns
too_many_requests. - JavaScript in your HTML does not run. Send finished HTML and CSS.
- Public images, stylesheets and fonts on https addresses load. Addresses on private networks are blocked. For the most reliable result, put images inside the HTML as
data:links. - Pages have 15 mm margins and backgrounds are printed.
- We do not save your HTML or your PDF.
- Need a new key or a bigger plan? Both are in the dashboard. Questions: support@getprintoza.com.
Bilmekte fayda var
- Üretilen her PDF, aylık planınızdan 1 hak düşer. PDF’i üretemezsek hakkınızdan düşmez.
- Hız sınırı: Ücretsiz planda dakikada 10, ücretli planlarda dakikada 60 istek. Aşarsanız
too_many_requestsdöner. - HTML’inizdeki JavaScript çalışmaz. Hazır HTML ve CSS gönderin.
- https adreslerindeki herkese açık görseller, stil dosyaları ve yazı tipleri yüklenir. Özel ağ adresleri engellenir. En sağlam sonuç için görselleri HTML’in içine
data:bağlantısı olarak koyun. - Sayfa kenar boşlukları 15 mm’dir ve arka planlar basılır.
- HTML’inizi ve PDF’inizi kaydetmeyiz.
- Yeni anahtar mı, daha büyük plan mı lazım? İkisi de panelde. Sorularınız için: support@getprintoza.com.