Empty boxes instead of Arabic in a PDF
Where the Arabic should be, the PDF shows empty rectangles, question marks or nothing at all. It often happens with invoices, receipts and reports that a program or a website makes on its own and then emails to a customer. The same happens with Persian and Urdu.
Why you see boxes
A box is what a font draws for a letter it does not have. So boxes mean that the font used for the Arabic had no Arabic letters in it.
- The PDF was made with a font that has no Arabic. Many PDF libraries start with fonts such as Helvetica or Times, which have Latin letters only. Unless the code names a font with Arabic letters, every Arabic letter becomes a box.
- The server that makes the PDF has no Arabic font. HTML to PDF tools use the fonts installed on the machine. A laptop has Arabic fonts; a small server or container image often has none, so the same page that looks right in your browser comes out as boxes.
- The font was not embedded. If the PDF names a font but does not carry it, the reader's device has to supply one. On a phone or computer without that font the reader sees boxes, while the file looked right where it was made.
- The letters are Persian or Urdu only. Some Arabic fonts lack letters such as پ چ ژ گ for Persian or ے ڑ ں for Urdu, so those letters alone turn into boxes.
How to fix it
- Make the PDF again from the text. Paste the text into RTL PDF and download the PDF. It uses fonts with Arabic, Persian and Urdu letters and embeds them in the file, so it looks the same on any device. Free, no account.
- For invoices and receipts, the invoice maker and receipt maker fill in Arabic or bilingual documents with the fonts already embedded.
- To check a PDF you received, open its document properties in your PDF viewer and look at the fonts. Each font should say "Embedded" or "Embedded Subset". A font without that word is the likely cause.
If your code makes the PDFs
- Register a font that has Arabic letters and use it for the Arabic text. Many good ones are free under open font licences. Do not rely on the library's built in fonts.
- Embed the font. Most libraries embed a font you load from a file; check the output's font list once.
- Install the font on the server (or in the container image) when you turn HTML into PDF, and name it in the CSS
font-family. - Fonts alone do not join the letters. Once the boxes are gone, the letters may still come out apart or reversed if the library does no shaping. See Arabic letters separated in a PDF.
- Or let RTL PDF do the shaping. It is also a remote MCP server at
https://rtlpdf.com/mcpthat AI assistants and agents can call to turn Arabic, Persian or Urdu text into a finished PDF. Setup: Connect.
Other Arabic PDF problems
مربعات فارغة بدل العربية في ملف PDF
حيث يجب أن تظهر العربية يعرض ملف PDF مستطيلات فارغة أو علامات استفهام أو لا شيء. يحدث هذا كثيرا في الفواتير والإيصالات والتقارير التي ينشئها برنامج أو موقع تلقائيا ثم يرسلها إلى العميل بالبريد. ويحدث الشيء نفسه مع الفارسية والأردية.
لماذا تظهر المربعات
المربع هو ما يرسمه الخط مكان حرف ليس فيه. فالمربعات تعني أن الخط المستخدم للعربية لا يحتوي على حروف عربية.
- صُنع الملف بخط بلا عربية. كثير من مكتبات PDF تبدأ بخطوط مثل Helvetica أو Times، وفيها حروف لاتينية فقط. وما لم يحدد البرنامج خطا فيه حروف عربية يصير كل حرف عربي مربعا.
- الخادم الذي ينشئ الملف ليس فيه خط عربي. أدوات تحويل HTML إلى PDF تستعمل الخطوط المثبتة على الجهاز. الحاسوب المحمول فيه خطوط عربية، أما الخادم الصغير أو الحاوية فكثيرا ما يخلو منها، فتخرج الصفحة التي تظهر صحيحة في متصفحك مربعات.
- الخط غير مضمّن في الملف. إذا ذكر الملف اسم الخط ولم يحمله معه، فعلى جهاز القارئ أن يوفره. وعلى هاتف أو حاسوب ليس فيه هذا الخط يرى القارئ مربعات، مع أن الملف ظهر صحيحا حيث أُنشئ.
- الحروف فارسية أو أردية فقط. بعض الخطوط العربية تخلو من حروف مثل پ چ ژ گ للفارسية أو ے ڑ ں للأردية، فتصير هذه الحروف وحدها مربعات.
كيف تصلحها
- أنشئ الملف من جديد من النص. الصق النص في RTL PDF ونزّل الملف. يستعمل خطوطا فيها الحروف العربية والفارسية والأردية ويضمّنها في الملف، فيظهر بالشكل نفسه على أي جهاز. مجانا وبدون حساب.
- للفواتير والإيصالات، يملأ منشئ الفواتير ومنشئ الإيصالات مستندات عربية أو ثنائية اللغة والخطوط مضمّنة فيها.
- لفحص ملف وصلك، افتح خصائص المستند في برنامج عرض PDF وانظر إلى الخطوط. يجب أن يُكتب بجانب كل خط "Embedded" أو "Embedded Subset" (مضمّن). والخط الذي يخلو من هذه الكلمة هو السبب المرجح.
إذا كان برنامجك هو الذي ينشئ الملفات
- أضف خطا فيه حروف عربية واستعمله للنص العربي. وكثير من الخطوط الجيدة مجاني بتراخيص خطوط مفتوحة. ولا تعتمد على الخطوط المدمجة في المكتبة.
- ضمّن الخط في الملف. معظم المكتبات تضمّن الخط الذي تحمّله من ملف، فافحص قائمة الخطوط في الناتج مرة واحدة.
- ثبّت الخط على الخادم (أو في صورة الحاوية) حين تحول HTML إلى PDF، واذكر اسمه في
font-familyفي CSS. - الخط وحده لا يربط الحروف. بعد زوال المربعات قد تظهر الحروف منفصلة أو معكوسة إذا كانت المكتبة لا تربط الحروف. راجع الحروف العربية منفصلة في ملف PDF.
- أو دع RTL PDF يربط الحروف. هو أيضا خادم MCP عن بعد على
https://rtlpdf.com/mcpتستخدمه المساعدات الذكية ووكلاء الذكاء الاصطناعي لتحويل نص عربي أو فارسي أو أردي إلى ملف PDF جاهز. طريقة الإعداد: الربط.