We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to set background image Stream to a cell in pdf

Hi Team,

                      I need to set a background image to a cell but my image will be a Stream and i don't want to set it from a path.(Cell.BackgroundImageFile). i want to set image as a background from a Stream.Please guide me to achieve this.

Regards,
Divya.M

@Divyakailash

Thanks for contacting support.

You may load your image from stream, save it temporarily to some physical location, add it as a background of cell and delete after saving the PDF documents. You may achieve this by something like following:

System.Drawing.Image img = new Bitmap(imgStream); // imgStream is your image stream
img.Save(dataDir + "SavedImage.jpg");
Header.Cells[1].BackgroundImageFile = dataDir + "SavedImage.jpg";
// Delete the saved file after document is saved.
document.Save(dataDir + "OutputTable.pdf");
File.Delete(dataDir + "SavedImage.jpg");

In case there is more of your requirement, please feel free to let us know.