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

Free Support Forum - aspose.com

Add Byte / Base64 Image to a PDF

Hi,
How I can Add Byte / Base64 Image to a PDF? Currently I am using imageStamp but it is taking imageStream. I want to send byte[].

Please advise me.

Thanks

@adadadsad

Thank you for contacting support.

You may convert Base64 image to JPG/PNG as in the code snippet below and then use converted image as per your requirements.

string source = "data:image/png;base64,iVBORw0KGgoAAA...";
string base64ImageString = source.Replace("data:image/png;base64,", String.Empty);
string filePath = dataDir + "Aspose.PDF_19.1.jpg";
File.WriteAllBytes(filePath, Convert.FromBase64String(base64ImageString));

We hope this will be helpful. Please feel free to contact us if you need any further assistance.