hindi_pdf_fixer 1.0.0 copy "hindi_pdf_fixer: ^1.0.0" to clipboard
hindi_pdf_fixer: ^1.0.0 copied to clipboard

Unicode-first Hindi PDF text shaping for Flutter, powered by pdf_text_shaper and HarfBuzz.

example/main.dart

import 'dart:io';

import 'package:hindi_pdf_fixer/hindi_pdf_fixer.dart';
import 'package:pdf/pdf.dart';
import 'package:pdf/widgets.dart' as pw;

Future<void> main(List<String> args) async {
  if (args.isEmpty) {
    stderr.writeln('Usage: dart run example/main.dart /path/to/NotoSansDevanagari-Regular.ttf');
    exitCode = 64;
    return;
  }

  final fontBytes = await File(args.first).readAsBytes();
  final font = ShapedFont.fromBytes(fontBytes, name: 'Hindi example');

  try {
    final document = pw.Document();
    document.addPage(
      pw.Page(
        pageFormat: PdfPageFormat.a4,
        build: (_) => pw.Column(
          crossAxisAlignment: pw.CrossAxisAlignment.start,
          children: [
            HindiHeader(
              'Hindi PDF shaping',
              font: font,
              fontSize: 24,
            ),
            pw.SizedBox(height: 16),
            HindiParagraph(
              'हिन्दी: मैं हिंदी में लिख रहा हूँ।',
              font: font,
              fontSize: 16,
            ),
            pw.SizedBox(height: 12),
            HindiText(
              'क्षत्रिय नियुक्ति प्राधिकारी शिक्षा संस्कृति परीक्षा',
              font: font,
              fontSize: 18,
            ),
          ],
        ),
      ),
    );

    await File('hindi_pdf_fixer_example.pdf').writeAsBytes(await document.save());
  } finally {
    font.dispose();
  }
}
0
likes
150
points
89
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

Unicode-first Hindi PDF text shaping for Flutter, powered by pdf_text_shaper and HarfBuzz.

Repository (GitHub)
View/report issues

Topics

#hindi #devanagari #pdf #unicode #typography

License

Apache-2.0 (license)

Dependencies

flutter, pdf, pdf_text_shaper

More

Packages that depend on hindi_pdf_fixer