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

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

example/main.dart

import 'dart:io';

import 'package:lao_pdf_fixer/lao_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/NotoSansLao-Regular.ttf');
    exitCode = 64;
    return;
  }

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

  try {
    final document = pw.Document();
    document.addPage(
      pw.Page(
        pageFormat: PdfPageFormat.a4,
        build: (_) => pw.Column(
          crossAxisAlignment: pw.CrossAxisAlignment.start,
          children: [
            LaoHeader(
              'Lao PDF shaping',
              font: font,
              fontSize: 24,
            ),
            pw.SizedBox(height: 16),
            LaoParagraph(
              'ພາສາລາວ: ຂ້ອຍກຳລັງຂຽນພາສາລາວ.',
              font: font,
              fontSize: 16,
            ),
            pw.SizedBox(height: 12),
            LaoText(
              'ສະບາຍດີໂລກ ການສຶກສາ ນັກຮຽນ ການສອບເສັງ ປະກາດ',
              font: font,
              fontSize: 18,
            ),
          ],
        ),
      ),
    );

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

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

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

Repository (GitHub)
View/report issues

Topics

#lao #pdf #unicode #text-shaping #typography

License

Apache-2.0 (license)

Dependencies

flutter, pdf, pdf_text_shaper

More

Packages that depend on lao_pdf_fixer