---
title: Convert HTML to Arabic RTL PDF API
slug: convert-html-to-arabic-pdf
url: https://apyhub.com/odelyo/service/convert-html-to-arabic-pdf
provider: Odelyo
categories: [Document Intelligence Kit, Output Kit]
tags: [arabic-pdf, html-to-pdf, invoice-pdf, receipt-pdf, rtl-text, document-generation]
auth: api_key
version: 1.0.0
service_type: sync
endpoints: 1
atoms: 10
mcp: true
---

# Convert HTML to Arabic RTL PDF API

Arabic HTML to PDF API: send HTML and CSS, get a right-to-left PDF as base64 or a file, with Arabic fonts and A4 or receipt sizes. Free tier, no card.

## Endpoints

| Method | URL | Description | Atoms |
| --- | --- | --- | --- |
| POST | `https://api.eu.apyhub.com/odelyo/convert-html-to-arabic-pdf/documents` | What it does Renders the HTML you send into a PDF, with right-to-left layout and Arabic fonts. Retu… | 10 |

## Endpoint reference

### HTML to PDF

`POST https://api.eu.apyhub.com/odelyo/convert-html-to-arabic-pdf/documents` · 10 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `css` | body | string | no | Extra CSS applied to the page. Example: `h1{color:#0a7;font-size:32px}`. |
| `font` | body | string | no | Arabic font family. One of: naskh, kufi, sans, amiri. Default: `naskh`. Example: `amiri`. |
| `html` | body | string | yes | The HTML to render. A fragment or a full document. Example: `<h1>مرحبا بالعالم</h1><p>هذا مستند تجريبي. Invoice ١٢٣</p>`. |
| `format` | body | string | no | Page size. One of: A4, A5, Letter, Legal, receipt-80mm, receipt-58mm. Default: `A4`. Example: `A4`. |
| `output` | body | string | no | Response format. binary returns the PDF bytes with Content-Type application/pdf. One of: base64, binary. Default: `base64`. Example: `base64`. |
| `filename` | body | string | no | Download name in the Content-Disposition header when output is binary. Ignored for base64. Default: `document.pdf`. Example: `invoice-1001.pdf`. |
| `direction` | body | string | no | Text direction. auto uses rtl when the content has Arabic. One of: auto, rtl, ltr. Default: `auto`. Example: `auto`. |
| `landscape` | body | boolean | no | Render the page in landscape orientation. Default: `false`. Example: `false`. |
| `margin_mm` | body | number | no | Page margin in millimetres. Example: `10`. |
| `footer_html` | body | string | no | HTML for the page footer. Example: `<div style="font-size:10px">تذييل</div>`. |
| `header_html` | body | string | no | HTML for the page header. Example: `<div style="font-size:10px">رأس الصفحة</div>`. |
| `page_numbers` | body | boolean | no | Add page numbers. Default: `false`. Example: `true`. |

#### Quickstart

Send a short Arabic HTML snippet and get back an A4 PDF as base64.

```bash
curl -X POST "https://api.eu.apyhub.com/odelyo/convert-html-to-arabic-pdf/documents" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"html":"<h1>مرحبا بالعالم</h1><p>هذا مستند تجريبي. Invoice ١٢٣</p>"}'
```

#### What you'll get back

Returns a JSON object with `data` (the PDF as base64, its size in bytes and its page count) and `meta` (request ID and API version).

```json
{
  "data": {
    "pdf_base64": "JVBERi0xLjQKJdPr6eEKMSAwIG9iago8PC9DcmVhdG9y...",
    "bytes": 19387,
    "pages": 1
  },
  "meta": {
    "request_id": "req_434ed7a6101436fa",
    "version": "v1"
  }
}
```

## About

## What it does
The Arabic HTML to PDF API turns your HTML and CSS into a PDF with right-to-left layout and Arabic fonts. Send the page as `html` and get the PDF back as base64 in JSON, or as a binary file.

Pick a font with `font`: `naskh` (default), `kufi`, `sans` or `amiri`. Set the page size with `format`: `A4` (default), `A5`, `Letter`, `Legal`, `receipt-80mm` or `receipt-58mm`. Use `direction` for text flow. The default `auto` switches to right to left when the content has Arabic, and `rtl` or `ltr` force one way. Add styles with `css`, page margins with `margin_mm` (0 to 40), and wide pages with `landscape`. `header_html` and `footer_html` add a header and footer, and `page_numbers` adds page numbers. With `output` set to `binary`, `filename` names the downloaded file.

Teams use the Arabic HTML to PDF API to print bilingual invoices from their own templates, make receipts for 80 mm and 58 mm printers, and export Arabic reports and letters. It also works as a plain HTML to PDF API for English or mixed content.

Scripts in your HTML do not run, so build the final page before you send it.

After rendering, stamp a "PAID" or "DRAFT" mark with the [PDF Watermark API](https://apyhub.com/apyhub/service/apply-watermark-on-pdf), or join several documents into one file with the [Merge Files to PDF API](https://apyhub.com/apyhub/service/merge-files-to-pdf).

## Usage

Base URL: `https://api.eu.apyhub.com` (default region — see
`GET https://apyhub.com/api/public/regions` for the rest).

Authenticate with an ApyHub API key in the `apy-token` header.
Full docs and a live playground: https://apyhub.com/odelyo/service/convert-html-to-arabic-pdf
