Skip to content

Arabic text renders incorrectly in Get PDF (wkhtmltopdf) but correctly in Browser Print Preview #2162

@Lucky-sam

Description

@Lucky-sam

Summary

Arabic text renders correctly in the browser Print Preview and when using Chrome's "Save as PDF", but renders differently when using ERPNext/Frappe's "Get PDF" functionality (wkhtmltopdf).

Environment

  • Frappe Cloud
  • Print Format Type: Jinja
  • PDF Generator: wkhtmltopdf
  • Arabic + English bilingual quotation/proposal

Expected Behavior

Arabic text should render identically in:

  1. Browser Print Preview
  2. Chrome Save as PDF
  3. ERPNext Get PDF

Actual Behavior

  • Browser Print Preview: Arabic renders correctly.
  • Chrome Save as PDF: Arabic renders correctly.
  • Get PDF (wkhtmltopdf): Arabic characters, ligatures, and RTL text render differently.

Examples observed:

  • Arabic labels appear differently in Get PDF.
  • Some Arabic words containing "الإ" / "الأ" render inconsistently.
  • RTL text positioning differs between browser rendering and generated PDF.

Additional Observation

The issue does not appear to be related to the print format itself.

The exact same HTML/CSS renders correctly when:

  • Using Browser Print Preview
  • Using Chrome "Save as PDF"

The rendering difference only appears when using ERPNext's "Get PDF" functionality.

This suggests the issue may be related to wkhtmltopdf font loading, Arabic shaping, RTL rendering, or the PDF engine configuration rather than the template.

What I Have Already Tried

Font Upload

Uploaded Arabic fonts to File Manager:

  • NotoSansArabic-Regular.ttf
  • NotoSansArabic-Bold.ttf

Font Face Configuration

@font-face {
    font-family: 'NotoArabic';
    src: url('/files/NotoSansArabic-Regular.ttf') format('truetype');
}

@font-face {
    font-family: 'NotoArabic';
    src: url('/files/NotoSansArabic-Bold.ttf') format('truetype');
    font-weight: 700;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions