PdfIconHelper class

Helper class for converting Flutter icons to PDF-compatible image bytes.

The pdf package does not support IconData directly, so this helper converts icons (Material Icons, FontAwesome, etc.) to PNG bytes that can be rendered in PDFs.

Example usage:

final iconBytes = await PdfIconHelper.iconToBytes(
  Icons.shopping_cart,
  size: 48,
  color: Colors.blue,
);

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

iconToBytes(IconData icon, {double size = 48, Color color = Colors.black}) Future<Uint8List>
Converts an IconData to PNG bytes that can be used in PDFs.
iconToBytesHiRes(IconData icon, {double size = 48, Color color = Colors.black}) Future<Uint8List>
Converts an IconData to PNG bytes with high resolution for better quality.
isFontAwesomeIcon(IconData icon) bool
Checks if the given IconData is from FontAwesome.
isMaterialIcon(IconData icon) bool
Checks if the given IconData is from the Material Icons font.