Add a generated ploty image to a pdf page in node js

Hi, Experts I am trying to generate a pdf using ploty in nodejs.
I am trying generate a graph which will returns a image.
I am using ploty.getImage() method.
here is my code::-
const xValues = [‘A’, ‘B’, ‘C’, ‘D’];
const yValues = [10, 20, 15, 25];
const trace = {
x: xValues,
y: yValues,
type: ‘bar’
};
const layout = {
title: ‘Simple Bar Graph’
};
const data = { ‘data’: [trace] };

const options = {
    format: 'png',
    width: 1000,
    height: 500
    };
plotly.getImage(data, options, function (error, imageStream) { 
  if(error) {console.log("Unable Generate plot")
      console.log(error);
      };
      doc.addImage(imageStream, 'PNG', 125, 63 , 100, 75);
});
  1. unable to trace what imageStream returns .
  2. in doc.addImage(<base64 string code for image data / htmlimage/ unit8array>) we need to pass.

can anyone help me with what does ‘imagestream’ tried to return as I have a blocker that i can’t run it locally I have to deploy and checks the log .