PdfBitmap.fromBase64String constructor

PdfBitmap.fromBase64String(
  1. String imageData
)

Initializes a new instance of the PdfBitmap class from the image data as base64 string

//Creates a new PDF document.
PdfDocument doc = PdfDocument();
//Draw the image.
document.pages.add().graphics.drawImage(
  PdfBitmap.fromBase64String(imageData), Rect.fromLTWH(10, 10, 400, 250));
//Saves the document.
List<int> bytes = doc.save();
//Dispose the document.
doc.dispose();

Implementation

PdfBitmap.fromBase64String(String imageData) {
  if (imageData.isEmpty) {
    ArgumentError.value(imageData, 'image data', 'image data cannot be null');
  }
  _helper = PdfBitmapHelper(this);
  _initialize(base64.decode(imageData));
}