printing 3.5.0 copy "printing: ^3.5.0" to clipboard
printing: ^3.5.0 copied to clipboard

outdated

Plugin that allows Flutter apps to generate and print documents to android or ios compatible printers

example/lib/main.dart

// ignore_for_file: always_specify_types
// ignore_for_file: public_member_api_docs

import 'package:flutter/material.dart';
import 'package:pdf/widgets.dart' as pw;
import 'package:printing/printing.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    const title = 'Printing Demo';

    return MaterialApp(
      title: title,
      home: Scaffold(
        appBar: AppBar(
          title: const Text(title),
        ),
        body: Center(
          child: IconButton(
            icon: const Icon(Icons.print),
            onPressed: _printDocument,
          ),
        ),
      ),
    );
  }

  void _printDocument() {
    Printing.layoutPdf(
      onLayout: (pageFormat) {
        final doc = pw.Document();

        doc.addPage(
          pw.Page(
            build: (pw.Context context) => pw.Center(
              child: pw.Text('Hello World!'),
            ),
          ),
        );

        return doc.save();
      },
    );
  }
}
1601
likes
0
pub points
100%
popularity

Publisher

verified publishernfet.net

Plugin that allows Flutter apps to generate and print documents to android or ios compatible printers

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_web_plugins, image, js, meta, pdf, plugin_platform_interface

More

Packages that depend on printing