Bangla PDF Fixer đ§
Bangla PDF Fixer is a Flutter package designed to fix broken Bangla fonts in PDFs, ensuring accurate rendering of Bangla characters with 22+ high-quality custom fonts.
A lightweight, focused solution for Bangla font issuesânothing more, nothing less.
Note: This package focuses exclusively on Bangla font correction. For advanced PDF generation features, consider
pdf_maker.

Features
- 22+ Bangla fonts for effortless customization of PDF text.
- Automatically rearranges complex Bangla characters for correct display.
- Seamless integration with Flutter PDF generation workflows.
- Ready-to-use Bangla widgets: text, headers, paragraphs, tables, and bullet lists.
Installation
Add to your pubspec.yaml:
dependencies:
bangla_pdf_fixer: ^2.0.0
Install packages:
flutter pub get
Usage â¨
NoteBanglaFontType: đ¨ TheBanglaFontTypeclass is a centralized enum of 22+ Bangla fonts for PDF generation. It simplifies working with Bangla text in Flutter by providing ready-to-usepw.TextStyleandpw.Textwidgets, making font assignment seamless and reducing boilerplate.
Step 1: Initialize Fonts
Before using any widgets, initialize the font manager:
await BanglaFontManager().initialize();
This ensures all fonts are loaded and ready for use.
Step 2: Fix Bangla Text in PDFs
Use the .fix extension to automatically correct broken Bangla text:
BanglaText(
'āĻŦāĻžāĻāϞāĻž āϏāĻžāϧāĻžāϰāĻŖ āĻā§āĻā§āϏāĻ',
fontType: BanglaFontType.kalpurush,
fontSize: 20,
),
pw.SizedBox(height: 10),
pw.Text(
'āĻŦā§āĻāĻā§ āĻĨāĻžāĻāĻžāϰ āĻŽāϤ āĻāύāύā§āĻĻ āĻāϰ āĻāĻŋāĻā§āĻ āύā§āĻāĨ¤'.fix,
style: BanglaFontType.july.ts(
fontSize: 24,
fontWeight: pw.FontWeight.bold,
color: PdfColors.red,
),
),
Most widgets apply
.fixinternally, so manual usage is optional.
Example: Generate a PDF in Flutter
import 'package:bangla_pdf_fixer/bangla_pdf_fixer.dart';
import 'package:pdf/widgets.dart' as pw;
import 'package:path_provider/path_provider.dart';
import 'package:open_file/open_file.dart';
import 'dart:io';
Future<void> generateAndOpenPdf() async {
await BanglaFontManager().initialize();
final pdf = pw.Document();
pdf.addPage(
pw.Page(
build: (context) => pw.Column(
crossAxisAlignment: pw.CrossAxisAlignment.start,
children: [
BanglaText(
'āĻŦāĻžāĻāϞāĻž āϏāĻžāϧāĻžāϰāĻŖ āĻā§āĻā§āϏāĻ',
fontType: BanglaFontType.kalpurush,
fontSize: 20,
),
pw.SizedBox(height: 10),
pw.Text(
'āĻŦā§āĻāĻā§ āĻĨāĻžāĻāĻžāϰ āĻŽāϤ āĻāύāύā§āĻĻ āĻāϰ āĻāĻŋāĻā§āĻ āύā§āĻāĨ¤'.fix,
style: BanglaFontType.july.ts(
fontSize: 24,
fontWeight: pw.FontWeight.bold,
color: PdfColors.red,
),
),
],
),
),
);
final dir = await getApplicationDocumentsDirectory();
final file = File("${dir.path}/example.pdf");
await file.writeAsBytes(await pdf.save());
await OpenFile.open(file.path);
}
Step 3: Use PDF Fixer Widgets
Bangla PDF Fixer provides ready-to-use widgets that automatically handle font corrections:
- BanglaText â Basic Bangla text
- BanglaRichText â Multi-style text spans
- BanglaHeader â Bold headers
- BanglaParagraph â Properly formatted paragraphs
- BanglaBulletList â Bullet lists
- BanglaTable â Tables with headers and formatted cells
These widgets integrate seamlessly with the pdf package, allowing you to focus on content while the package handles Bangla text corrections.
1. BanglaText
BanglaText(
'āĻŦāĻžāĻāϞāĻž āϏāĻžāϧāĻžāϰāĻŖ āĻā§āĻā§āϏāĻ',
fontType: BanglaFontType.kalpurush,
fontSize: 18,
);
2. BanglaRichText
BanglaRichText(
spans: [
BanglaTextSpan('āĻŦāĻžāĻāϞāĻž āĻŦā§āϞā§āĻĄ ', fontWeight: pw.FontWeight.bold),
BanglaTextSpan('āĻāĻŦāĻ āĻāĻāĻžāϞāĻŋāĻ', fontType: BanglaFontType.julyItalic),
],
);
3. BanglaHeader
BanglaHeader('āĻŦāĻžāĻāϞāĻž āĻļāĻŋāϰā§āύāĻžāĻŽ');
4. BanglaParagraph
BanglaParagraph('āĻŦāĻžāĻāϞāĻž āĻ
āύā§āĻā§āĻā§āĻĻ āĻāĻāĻžāύ⧠āϞā§āĻāĻž āĻšāĻŦā§āĨ¤');
5. BanglaBulletList
BanglaBulletList(
items: ['āĻĒā§āϰāĻĨāĻŽ āĻāĻāĻā§āĻŽ', 'āĻĻā§āĻŦāĻŋāϤā§āϝāĻŧ āĻāĻāĻā§āĻŽ', 'āϤā§āϤā§āϝāĻŧ āĻāĻāĻā§āĻŽ'],
bullet: '>',
);
6. BanglaTable
BanglaTable(
data: [
['āύāĻžāĻŽ', 'āĻŦā§āϏ', 'āĻļāĻšāϰ'],
['āĻāĻšāĻŽā§āĻĻ', '⧍ā§Ģ', 'āĻĸāĻžāĻāĻž'],
['āϏāĻžāϰāĻž', 'ā§Šā§Ļ', 'āĻāĻā§āĻāĻā§āϰāĻžāĻŽ'],
['āϰāĻžāĻšā§āϞ', 'ā§¨ā§Ž', 'āϏāĻŋāϞā§āĻ'],
],
fontType: BanglaFontType.tomalicca,
fontSize: 16,
fontWeight: pw.FontWeight.normal,
);
Step 4: TextStyle & Widget Shortcuts
// TextStyle shortcut
pw.Text(
'āĻŦāĻžāĻāϞāĻž āĻļāĻŋāϰā§āύāĻžāĻŽ'.fix,
style: BanglaFontType.july.ts(
fontSize: 24,
fontWeight: pw.FontWeight.bold,
color: PdfColors.red,
),
);
// Text widget shortcut
BanglaFontType.kalpurush.text(
'āĻŦāĻžāĻāϞāĻž āϞā§āĻāĻž',
fontSize: 18,
color: PdfColors.black,
);
Demo Preview đĨ
View a sample PDF output:
Click here to check the demo PDF
Contributing đ
Contributions are welcome! Whether you want to:
- Report a bug
- Suggest a feature
- Improve widgets or documentation
Fork the repository, make changes, and submit a Pull Request. Together, we can enhance Bangla PDF Fixer! đĄ
License
This project is licensed under the Apache License 2.0. Read the full license here.
Author
Maintained by AR Rahman Contact: arrahman.dev@outlook.com
Special Thanks đâ¨
A big thank you to all Bangla font creators and contributors. Your efforts make high-quality, beautiful Bangla PDFs possible. đ
â If you find Bangla PDF Fixer helpful, please star the repository!