a13n
Build AI agents and run them on cloud.
An HTML to PDF and screenshot API compatible with PDFShift and ScreenshotOne. It runs in Jeddah, and your data never leaves Saudi Arabia.
Developer toolsJava · C#GitHub @gyorgy-gulyasOnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
No updates detected yet. GitHub releases will appear here.
Owners of public repositories under a personal GitHub account can sign in to verify ownership and manage the introduction themselves. No administrator approval is needed.
Sign in, generate a verification file, and commit it to this repository’s default branch within 30 minutes. Files on other branches or forks do not count. Then check the file below to manage the project without administrator approval. Keep the file to retain your access.
If needed, you will go to sign-in. After signing in, return here and press your chosen verification button again.
Run /nomorevibe verify in your project folder to verify ownership and manage the introduction yourself.
Verify in one minuteAsk about other verification options
Arabic HTML to PDF and screenshot API hosted in Saudi Arabia: ready-to-run examples in curl, JavaScript, Python, .NET and Java
Translation pending
Taken from the repository README
Loading the full README.
Read the full README ↗Ready-to-run examples for Sahifa, an HTML-to-PDF and screenshot API that renders Arabic and right-to-left documents correctly and processes everything in Saudi Arabia (Jeddah).
Documentation · Quick start · OpenAPI · Pricing · Data residency
curl https://api.sahifa.dev/v3/convert/pdf \
--user "api:$SAHIFA_API_KEY" \
--header "Content-Type: application/json" \
--data '{"source": "<html dir=\"rtl\" lang=\"ar\"><body><h1>فاتورة ضريبية</h1></body></html>"}' \
--output invoice.pdf
Generating a PDF with Arabic text is harder than it should be. Most PDF libraries draw each Arabic letter in its isolated form, reverse the word order, or show ????, and mixed Arabic, English and numbers in one line make it worse. Typical symptoms:
ف ا ت و ر ة instead of فاتورة;? or empty boxes instead of Arabic characters;Sahifa avoids this by rendering your HTML in Chromium, the same engine as Chrome, with Arabic fonts installed (Noto Naskh Arabic, Noto Sans Arabic, Amiri, Noto Kufi Arabic). Whatever looks right in Chrome looks right in the PDF: letter joining, bidi reordering, dir="rtl", Arabic-Indic digits, and mixed Arabic/English.
For fintechs and other regulated companies in the Kingdom there is a second reason: documents such as account statements and invoices often may not leave Saudi Arabia. Sahifa runs on Oracle Cloud in Jeddah, does not store the documents you send, and signs a data processing agreement. See the data residency statement.
| PDF from HTML | Screenshot of a URL | Retry on busy / rate limit | |
|---|---|---|---|
| curl | curl/pdf.sh | curl/screenshot.sh | curl/retry.sh |
| JavaScript (Node 18+) | javascript/pdf.mjs | javascript/screenshot.mjs | javascript/retry.mjs |
| Python 3.8+ | python/pdf.py | python/screenshot.py | python/retry.py |
| .NET 8 (C#) | dotnet/pdf.cs | dotnet/screenshot.cs | dotnet/retry.cs |
| Java 18+ | java/Pdf.java |
Each example is a single file with no SDK: it uses the language's standard HTTP client (Python needs requests).
| Language | Install | Repository |
|---|---|---|
| Node.js / TypeScript | npm install sahifa | sahifa-node |
| Python | pip install sahifa | sahifa-python |
| Laravel / PHP | composer require sahifa/laravel | sahifa-laravel |
| n8n | Settings → Community Nodes → n8n-nodes-sahifa | n8n-nodes-sahifa |
The examples below use plain HTTP, so they also work in any other language.
export SAHIFA_API_KEY=sk_live_... # macOS / Linux
$env:SAHIFA_API_KEY = "sk_live_..." # Windows PowerShell
bash curl/pdf.sh
node javascript/pdf.mjs
python python/pdf.py
dotnet run dotnet/pdf.cs # .NET 10; or paste into a console app
java java/Pdf.java
run-all.sh runs every example against the live API and checks the output files.POST https://api.sahifa.dev/v3/convert/pdfCompatible with the PDFShift v3 API, so existing PDFShift code usually needs only the host name changed.
api and your key as the password, or the header X-API-Key: <key>.source (HTML or a URL, required), format (A4, Letter, …), landscape, margin, header / footer ({ "source": "<html>" } with {{page}} and {{total}}), css, javascript, delay, wait_for, pages, zoom.application/pdf).GET or POST https://api.sahifa.dev/takeCompatible with the ScreenshotOne API.
access_key parameter or the header X-Access-Key.url or html, format (png, jpeg, webp, pdf), viewport_width, viewport_height, full_page, device_scale_factor, selector, block_ads, block_cookie_banners, dark_mode, delay (seconds).Every parameter is in the API reference and the OpenAPI document.
A few things make Arabic documents look professional, whichever tool you use:
<html dir="rtl" lang="ar">
<head>
<meta charset="utf-8">
<style>
body { font-family: 'Noto Naskh Arabic', 'Amiri', serif; }
.ltr { direction: ltr; unicode-bidi: isolate; } /* IBANs, emails, SKUs inside Arabic text */
table { width: 100%; } /* columns mirror automatically with dir="rtl" */
@page { size: A4; margin: 15mm; }
</style>
</head>
<body>
<h1>فاتورة ضريبية مبسطة</h1>
<p>رقم الحساب: <bdi class="ltr">SA03 8000 0000 6080 1016 7519</bdi></p>
</body>
</html>
dir="rtl" on <html>, not only on single elements, so tables, lists and page layout mirror.<bdi> (or unicode-bidi: isolate) so they are not reordered with the Arabic text around them.font-variant-numeric: tabular-nums for amount columns so the digits line up.dir, instead of mixing them inside one paragraph.Sahifa turns your invoice HTML into a PDF; it does not issue or report e-invoices to ZATCA. If your system already produces the ZATCA QR code (phase 1 TLV or the phase 2 value from the cleared XML), put it into the HTML as an image or an inline SVG and it will be printed as is.
| Plan | Renders a month | Price (monthly, excl. VAT) |
|---|---|---|
| Sandbox | 100 (up to 10 a day), watermarked | free |
| Developer | 2,000 | SAR 59 |
| Business | 15,000 | SAR 199 |
| Compliance | 50,000, DPA and data residency letter | SAR 799 |
One PDF or one screenshot counts as one render. Current prices: sahifa.dev/en/#pricing.
Merchants on Salla and Zid can use the Sahifa app to print Arabic invoices, packing slips, receipts and quotations for their orders, without any code. See Sahifa for Salla and Zid stores.
Sahifa is a service of Yimello LLC, United Arab Emirates. The code in this repository is released under the MIT License; the Sahifa service itself is governed by its terms.
صحيفة واجهة برمجية لتحويل HTML إلى PDF ولقطات الشاشة، تعرض النصوص العربية واتجاه اليمين إلى اليسار بشكل صحيح، وتعمل بالكامل داخل المملكة العربية السعودية (جدة)، ولا تحتفظ بالمستندات التي ترسلها.
يحتوي هذا المستودع على أمثلة جاهزة للتشغيل بلغات curl وJavaScript وPython و.NET وJava. أنشئ حسابًا مجانيًا في sahifa.dev، وضع مفتاحك في المتغير SAHIFA_API_KEY، ثم شغّل أي مثال.
التوثيق الكامل بالعربية: sahifa.dev/docs · الدعم: [email protected]
Gulyás György Tamás — ggyt.hu
| java/Screenshot.java |
| java/Retry.java |