bangla_pdf_fixer 1.0.1 copy "bangla_pdf_fixer: ^1.0.1" to clipboard
bangla_pdf_fixer: ^1.0.1 copied to clipboard

A package to fix broken font issues in PDFs for Bangla text.

Bangla PDF Fixer 🔧 #

[Stand With Palestine]

Bangla PDF Fixer is a Flutter package designed to fix broken Bangla fonts while generating PDFs in Flutter using ANSI encoding. It converts Bangla text to Unicode, ensuring proper rendering and display of Bangla characters in PDFs using custom fonts. It's just a solution for broken Bangla font. Nothing more, nothing less.

[Bangla PDF Fixer]

Features #

  • Includes over 10 Bangla fonts, allowing you to easily customize the appearance of your PDF documents.
  • Rearrange complex Bangla characters for correct display.
  • Easy integration into Flutter projects for PDF generation and text correction.

Installation #

Add this package to your pubspec.yaml file:

dependencies:
  bangla_pdf_fixer: ^1.0.0

Run flutter pub get to install the package.

Usage ✨ #

Font Loading:

No need to Add any font manually. use the GetFonts class to access the desired font and load it with the FontManager.

PDF Generation:

Use the pdf package to create a document and add pages with Bangla text. Use the loaded Bangla font for proper rendering of Bangla characters.

Saving and Opening:

Save the generated PDF file in the device's documents directory. Open the PDF using the open_file package to display it with the default PDF viewer on the device.

Full Example 👨‍💻 #

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> generateAndOpenInvoice() async {
  // 1. Create a PDF document
  final pdf = pw.Document();

  // 2. Load Bangla font 
  final fontData = await FontManager.loadFont(GetFonts.kalpurush);
  final ttf = pw.Font.ttf(fontData);

  // 3. Add content to the PDF
  pdf.addPage(
    pw.Page(
      build: (pw.Context context) => pw.Center(
        child: pw.Text(
          'বেঁচে থাকার মত আনন্দ আর কিছুই নেই। ',
          style: pw.TextStyle(font: ttf, fontSize: 20),
        ),
      ),
    ),
  );

  // 4. Save the PDF to a file
  final outputDir = await getApplicationDocumentsDirectory();
  final file = File("${outputDir.path}/example.pdf");
  await file.writeAsBytes(await pdf.save());

  // 5. Open the PDF
  await OpenFile.open(file.path);
}

Change the Default Font 🔧 #

The bangla_pdf_fixer package includes over 10 Bangla fonts, allowing you to easily customize the appearance of your PDF documents. To change the default font, use the GetFonts class to access the desired font and load it with the FontManager. Here's an example of how to change font:

final fontData = await FontManager.loadFont(GetFonts.charukola);

Demo Preview 📥 #

Click here to check the output file

Contributing 🚀 #

We encourage contributions from developers who are passionate about improving this project. If you encounter bugs or have ideas for new features, feel free to make fixes or improvements and submit a Pull Request. Together, we can make this project even better! 💡

License #

This project is licensed under the MIT License. See the LICENSE file for details.

Author #

Bangla PDF Fixer is maintained by AR Rahman. You can contact me at [email protected].

Special Thanks 🙏✨ #

I would like to extend my heartfelt thanks to the creators and contributors of the Bangla fonts included in this package. Their hard work and dedication have made it possible to offer high-quality, beautiful fonts for the community. Without their contributions, this tool wouldn't be as effective in rendering Bangla text beautifully in PDF documents.

Thank you for helping make this project a success! 💖

If you find Bangla PDF Fixer helpful, please ⭐️ the repository!

9
likes
0
points
263
downloads

Publisher

verified publisherflutterwiki.com

Weekly Downloads

A package to fix broken font issues in PDFs for Bangla text.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on bangla_pdf_fixer