moussa_pdf

A secure, native PDF viewer Flutter plugin with drawing tools and snipping support for education workflows.

Features

  • Native PDF rendering (Android & iOS)
  • Tools: hand, pen, highlighter, snip
  • Vertical draggable toolbar (native)
  • Page navigation (prev / next)
  • Undo / clear per page
  • Snip (crop) part of a page as image bytes
  • Secure download with cache per (userId + fileId)
  • Designed for teacher / student explanation workflows

Platforms

  • Android (PdfRenderer + custom overlay)
  • iOS (PDFKit + native overlays)

Minimum versions:

  • Android: API 21+
  • iOS: 13.0+

Basic usage

MoussaPdfView(
  onCreated: (controller) async {
    await controller.openUrl(
      url: pdfUrl,
      userId: userId,
      fileId: fileId,
    );
  },
)

Controller

controller.openUrl({required String url, required String userId, required String fileId});
controller.openPage(int page);
controller.setTool(MoussaPdfTool tool);
controller.undo();
controller.clear();

Tools

MoussaPdfTool.hand
MoussaPdfTool.pen
MoussaPdfTool.highlighter
MoussaPdfTool.snip

Events

Listen to all native events:

controller.events.listen((event) {
  print(event.type);
});

Common events:

  • opened
  • downloadProgress
  • pageChanged
  • toolChanged
  • error

Snip stream

controller.snips.listen((snip) {
  final Uint8List image = snip.bytes;
  final int page = snip.page;
});

Snip object:

  • bytes (PNG image)
  • page (zero-based index)
  • rectNormalized

Typical flow (education use-case)

  1. Student opens protected PDF
  2. Uses native snip tool
  3. Flutter receives cropped image
  4. App sends the image to teacher / AI backend

Example

See example/ folder.

License

MIT License © 2026 MoussaIT
Developed by Mostafa Azazy

See the LICENSE file for full details.

Author

Mostafa Azazy
Principal Mobile Engineer
MoussaIT

Contributions

Contributions are welcome if they:

  • Improve production stability
  • Keep the API minimal & predictable
  • Avoid demo-only or experimental logic