dart_pdf
dart_pdf copied to clipboard
Arab Chars don't work
Describe the bug
You can't print arab chars to the PDF file properly
To Reproduce Code snippet to reproduce the behavior:
final pdf = pw.Document();
final font = pw.Font.ttf(await rootBundle.load('fonts/Lateef-Regular.ttf')); // or any other font that supports arabic letters
pdf.addPage(pw.Page(
pageFormat: PdfPageFormat.a4,
build: (pw.Context context) {
return pw.Center(
child: pw.Text(text, style: pw.TextStyle(font: font, fontSize: 30),textDirection: pw.TextDirection.rtl) // Try any direction they all create wrong results
); // Center
})
); // Page
// Save
await file.writeAsBytes(await pdf.save());
Expected behavior
The resulting text should be from right to left and not mutilated.
Screenshots
With TextDirection
omitted
With TextDirection.rtl
Flutter Doctor
[√] Flutter (Channel stable, 2.10.3, on Microsoft Windows [Version 10.0.19044.1586], locale de-DE)
• Flutter version 2.10.3 at D:\Rashid\Programmieren\Programs\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7e9793dee1 (3 weeks ago), 2022-03-02 11:23:12 -0600
• Engine revision bd539267b4
• Dart version 2.16.1
• DevTools version 2.9.2
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\Rashid\AppData\Local\Android\sdk
• Platform android-31, build-tools 30.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.10)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.11.32126.315
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2021.1)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
[√] VS Code (version 1.65.2)
• VS Code at C:\Users\Rashid\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.36.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.1586]
• Chrome (web) • chrome • web-javascript • Google Chrome 99.0.4844.82
• Edge (web) • edge • web-javascript • Microsoft Edge 99.0.1150.39
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Desktop (please complete the following information):
- [ ] iOS
- [ ] Android
- [ ] Browser
- [x] Windows
- [ ] Linux
Update PDF and Print Package
use directionality with rtl and arabic font like cairo
did you find a replacement!!
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days
Closing this stale issue because it has no activity.